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
Integration with MongoDB #535
Conversation
@Martin7-1 if this module can be used for local MongoDB as well, maybe we should remove "-atlas" part from the name? Now it assumes that only atlas can be used... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Martin7-1 thanks a lot!
...hain4j-mongodb-atlas/src/main/java/dev/langchain4j/store/embedding/mongodb/MappingUtils.java
Outdated
Show resolved
Hide resolved
...hain4j-mongodb-atlas/src/main/java/dev/langchain4j/store/embedding/mongodb/IndexMapping.java
Outdated
Show resolved
Hide resolved
...hain4j-mongodb-atlas/src/main/java/dev/langchain4j/store/embedding/mongodb/MappingUtils.java
Outdated
Show resolved
Hide resolved
...ngodb-atlas/src/main/java/dev/langchain4j/store/embedding/mongodb/MongoDBEmbeddingStore.java
Outdated
Show resolved
Hide resolved
...ngodb-atlas/src/main/java/dev/langchain4j/store/embedding/mongodb/MongoDBEmbeddingStore.java
Outdated
Show resolved
Hide resolved
...ngodb-atlas/src/main/java/dev/langchain4j/store/embedding/mongodb/MongoDBEmbeddingStore.java
Outdated
Show resolved
Hide resolved
...tlas/src/test/java/dev/langchain4j/store/embedding/mongodb/MongoDBEmbeddingStoreCloudIT.java
Outdated
Show resolved
Hide resolved
...tlas/src/test/java/dev/langchain4j/store/embedding/mongodb/MongoDBEmbeddingStoreLocalIT.java
Outdated
Show resolved
Hide resolved
I think it can't be used for local MongoDB. |
Ok, got it, thanks for explanation! |
I am not sure what is the exact reason, but both tests fail for me at the moment. |
I haven't finished it yet, fix will be done in this week. Currently I am confused with the difference between |
@langchain4j Hi, all tests are passed three times in my local and cloud. Please ensure your Atlas Search index are created as follow: {
"mappings": {
"dynamic": false,
"fields": {
"embedding": {
"dimensions": 384,
"similarity": "cosine",
"type": "knnVector"
},
"metadata": {
"dynamic": false,
"fields": {
"test-key": {
"type": "token"
}
},
"type": "document"
}
}
}
} As for the question you mentioned about |
@Martin7-1 thank you, |
@Martin7-1 I will merge this now and add a javadoc with json config to include it in this release (today) |
Currently our implementation use "Atlas Search" as our index, the difference between them is:
I am not sure which one is correct because they seems all work fine. Choosing |
see original PR #254. There are four mainly differences:
Testcontainer
and MongoDB Atlas Local Deployment to testMongoDBEmbeddingStore
initialize, rather than create when adding new embedding at the first time.BsonUtils
, which is replaced byorg.bson.Document
to create index mapping.langchain4j-mongodb
tolangchain4j-mongodb-atlas
Local deployment tests are all passed, but cloud tests are not tested yet because I encounter some network problem when communicating with MongoDB Atlas. (But I think it doesn't matter, because local deployment is the same as cloud, the purpose of local deployment is to development and test)