Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MongoDB Atlas $vectorSearch vector search #2825

Merged

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Oct 6, 2023

This PR is the JS equivalent of langchain-ai/langchain#11139.

This PR add support for the $vectorSearch stage in the MongoDB Atlas VectorStore. $vectorSearch was announced at MongoDB .local London.

Some notes:

  • We don't have access to Cohere, so I changed the existing integration tests to use OpenAI. I'm happy to change them back if needed but I'll need help getting access to Cohere. The tests pass locally for me but I left them skipped because they're skipped in main.
  • I made a few cleanups to the MongoDB atlas implementation and isolated them in this commit. Happy to revert.

Same as with the Python implementation, this is a breaking change.

@vercel
Copy link

vercel bot commented Oct 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Oct 9, 2023 10:58pm

@dosubot dosubot bot added the auto:improvement Medium size change to existing code to handle new use-cases label Oct 6, 2023
@@ -25,11 +27,7 @@ import { Document } from "../../document.js";
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment flags a change in the code that explicitly accesses an environment variable via process.env, and it should be reviewed by maintainers.

@jacoblee93
Copy link
Collaborator

Seems fine, is there no SDK update required?

@jacoblee93 jacoblee93 self-assigned this Oct 6, 2023
@jacoblee93 jacoblee93 added the lgtm PRs that are ready to be merged as-is label Oct 6, 2023
@jacoblee93
Copy link
Collaborator

Could you also please run yarn format and yarn lint?

@jacoblee93 jacoblee93 added the close PRs that need one or two touch-ups to be ready label Oct 7, 2023
@baileympearson
Copy link
Contributor Author

Hey @jacoblee93 - I linted and formatted, hopefully it passes CI now.

The changes here are compatible with the existing mongodb version specified - no dependency bump required.

@jacoblee93
Copy link
Collaborator

Thank you!

@jacoblee93
Copy link
Collaborator

@baileympearson I get this when running integration tests:

$vectorSearch is not allowed or the syntax is incorrect, see the Atlas documentation for more information

Do I need to upgrade something else? If so, can we add something to the docs with instructions?

@jacoblee93 jacoblee93 added question Further information is requested and removed close PRs that need one or two touch-ups to be ready labels Oct 9, 2023
@baileympearson
Copy link
Contributor Author

@jacoblee93 You must be using MongoDB 7.0 or later in Atlas - I've added a note to the documentation about this

@jacoblee93
Copy link
Collaborator

No backcompat is a bummer :(

But thank you for the docs! Will merge with tonight's release.

@jacoblee93 jacoblee93 removed the question Further information is requested label Oct 10, 2023
@jacoblee93 jacoblee93 merged commit d5e9688 into langchain-ai:main Oct 10, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases lgtm PRs that are ready to be merged as-is
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants