-
Notifications
You must be signed in to change notification settings - Fork 843
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
MongoDB Atlas Vector Store Support #376
MongoDB Atlas Vector Store Support #376
Conversation
This aggregation is used to actually preform the search on a given collection with embeddings
Integration test runs fine given... - You have a mongo atlas cluster to connect to (local or remote) - You have the search index "spring_ai_vector_search" setup correctly - Need to explore getting around this
Integration test runs fine given... - You have a mongo atlas cluster to connect to (local or remote) - You have the search index "spring_ai_vector_search" setup correctly - Need to explore getting around this - Need to filter results using threshold
Integration test runs fine given... - You have a mongo atlas cluster to connect to (local or remote) - You have the search index "spring_ai_vector_search" setup correctly - Need to explore getting around this - Need to filter results using threshold
Integration test runs fine given... - You have a mongo atlas cluster to connect to (local or remote) - You have the search index "spring_ai_vector_search" setup correctly - Need to explore getting around this - Need to filter results using threshold
While a post filter is not ideal, it gets the job done. The mongo team seems to be working on having it availible as a prefilter option, in which this implementation can be updated to use later
This is great! thanks for contributing @Kirbstomper ! |
Added some more documentation and a builder for configuration I'm thinking of renaming the module to |
To be consistent with the other store names you should use the I've noticed that MongoDB Atlas provides filtering support. Perhaps we can map our metadata filtering to it. |
...-atlas-store/src/test/java/org/springframework/ai/vectorstore/MongoDBAtlasVectorStoreIT.java
Show resolved
Hide resolved
@tzolov Ideally I want to be able to check if this search index already exist and then update the index instead, but the |
Hey @Kirbstomper , thanks for your contribution. Good stuff. I've reviewed and made some small fixes before merging it. |
Holding off squashing/documentation further until I get some eyes on it.
This implements a
VectorStore
on MongoDB Atlas. This does NOT work with MongoDB hosted outside of Atlas as using vector search requires creating a search index through Atlas.More on how that works under the hood here: https://www.mongodb.com/docs/atlas/atlas-search/atlas-search-overview/
As for configuration, I figured we could provide some defaults, but ideally allow users to set the following themselves as much of it is reliant on whatever they have setup in Atlas.
We query the database using an aggregation search and preform a post-filter in the pipeline to filter out anything below the threshold value.
https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#mongodb-pipeline-pipe.-vectorSearch
One thing I have noticed (and why I have a terrible sleep(5000) in the test for now....) is that the indexing does not happen instantly.