类 MongoDbEmbeddingStore
java.lang.Object
dev.langchain4j.store.embedding.mongodb.MongoDbEmbeddingStore
- 所有已实现的接口:
EmbeddingStore<TextSegment>
Represents a MongoDB index as an embedding store.
More info to set up MongoDb as vectorDatabase.
tutorial how to use a knn-vector in MongoDB Atlas (great starting point).
If you are using a free tier, #createIndex = true might not be supported,
so you will need to create an index manually.
In your Atlas web console go to: DEPLOYMENT -> Database -> {your cluster} -> Atlas Search -> Create Index Search
-> "JSON Editor" under "Atlas Search" -> Next -> Select your database in the left pane
-> Insert the following JSON into the right pane (set "dimensions" and "metadata"->"fields" to desired values)
{
"mappings": {
"dynamic": false,
"fields": {
"embedding": {
"dimensions": 384,
"similarity": "cosine",
"type": "knnVector"
},
"metadata": {
"dynamic": false,
"fields": {
"test-key": {
"type": "token"
}
},
"type": "document"
}
}
}
}
-> Next -> Create Search Index-
嵌套类概要
嵌套类 -
构造器概要
构造器构造器说明MongoDbEmbeddingStore(com.mongodb.client.MongoClient mongoClient, String databaseName, String collectionName, String indexName, Long maxResultRatio, com.mongodb.client.model.CreateCollectionOptions createCollectionOptions, org.bson.conversions.Bson filter, IndexMapping indexMapping, Boolean createIndex) -
方法概要
修饰符和类型方法说明add(Embedding embedding, TextSegment textSegment) voidaddAll(List<Embedding> embeddings, List<TextSegment> embedded) builder()findRelevant(Embedding referenceEmbedding, int maxResults, double minScore) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 dev.langchain4j.store.embedding.EmbeddingStore
findRelevant, findRelevant, findRelevant, remove, removeAll, removeAll, removeAll, search
-
构造器详细资料
-
MongoDbEmbeddingStore
public MongoDbEmbeddingStore(com.mongodb.client.MongoClient mongoClient, String databaseName, String collectionName, String indexName, Long maxResultRatio, com.mongodb.client.model.CreateCollectionOptions createCollectionOptions, org.bson.conversions.Bson filter, IndexMapping indexMapping, Boolean createIndex)
-
-
方法详细资料
-
builder
-
add
- 指定者:
add在接口中EmbeddingStore<TextSegment>
-
add
- 指定者:
add在接口中EmbeddingStore<TextSegment>
-
add
- 指定者:
add在接口中EmbeddingStore<TextSegment>
-
addAll
- 指定者:
addAll在接口中EmbeddingStore<TextSegment>
-
addAll
- 指定者:
addAll在接口中EmbeddingStore<TextSegment>
-
findRelevant
public List<EmbeddingMatch<TextSegment>> findRelevant(Embedding referenceEmbedding, int maxResults, double minScore) - 指定者:
findRelevant在接口中EmbeddingStore<TextSegment>
-