chore(deps): remove @langchain/openai dependency and simplify test mocks#62
Open
earlgreylabs wants to merge 1 commit into
Open
chore(deps): remove @langchain/openai dependency and simplify test mocks#62earlgreylabs wants to merge 1 commit into
earlgreylabs wants to merge 1 commit into
Conversation
a0a7506 to
22fb2dd
Compare
22fb2dd to
0998b4f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the
@langchain/openaipackage from our dependencies, simplifies our unit test mocks, and adds unit test coverage for our local embeddings utility.Motivation
The
@langchain/openaidependency is only used directly in the test suite, as our production codebase relies on local@xenova/transformersfor feature extraction.This PR removes that dependency and simplifies our unit tests by mocking our local
src/utils/embeddings.tsutility functions directly, rather than relying on mocking the internals or modules of an external embeddings provider. Additionally, it introduces unit tests forembeddings.tsto restore 100% test coverage for local embeddings utility.Changes
package.json:@langchain/openaifrom dependencies.src/docs/store/DocumentStore.test.ts:OpenAIEmbeddings.src/utils/embeddings.tsto isolate unit tests.src/utils/embeddings.ts:embedDocumentsto handle empty inputs gracefully without invoking the neural-network extractor.src/utils/embeddings.test.ts[NEW]:vi.hoistedto mock the@xenova/transformerspipeline around top-level awaits.embedDocumentandembedDocumentsunder standard usage, empty inputs, empty arrays, and multi-document queries.Verification
npm ls @langchain/openai: no packagesnpm run check: passing (clean formatting, linting, and type-checking)npm test: passing (all 86 tests successfully completed)