Class AzureCosmosDbMongoVCoreEmbeddingStore
java.lang.Object
dev.langchain4j.store.embedding.azure.cosmos.mongo.vcore.AzureCosmosDbMongoVCoreEmbeddingStore
- All Implemented Interfaces:
dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
public class AzureCosmosDbMongoVCoreEmbeddingStore
extends Object
implements dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
Represents an Azure CosmosDB Mongo vCore as an embedding store.
More info to set up MongoDb as vectorDatabase.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic enum -
Constructor Summary
ConstructorsConstructorDescriptionAzureCosmosDbMongoVCoreEmbeddingStore(com.mongodb.client.MongoClient mongoClient, String connectionString, String databaseName, String collectionName, String indexName, String applicationName, com.mongodb.client.model.CreateCollectionOptions createCollectionOptions, Boolean createIndex, String kind, Integer numLists, Integer dimensions, Integer m, Integer efConstruction, Integer efSearch) -
Method Summary
Modifier and TypeMethodDescriptionadd(dev.langchain4j.data.embedding.Embedding embedding) add(dev.langchain4j.data.embedding.Embedding embedding, dev.langchain4j.data.segment.TextSegment textSegment) voidaddAll(List<dev.langchain4j.data.embedding.Embedding> embeddings, List<dev.langchain4j.data.segment.TextSegment> embedded) builder()List<dev.langchain4j.store.embedding.EmbeddingMatch<dev.langchain4j.data.segment.TextSegment>> findRelevant(dev.langchain4j.data.embedding.Embedding referenceEmbedding, int maxResults, double minScore) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.store.embedding.EmbeddingStore
findRelevant, findRelevant, findRelevant, search
-
Constructor Details
-
AzureCosmosDbMongoVCoreEmbeddingStore
public AzureCosmosDbMongoVCoreEmbeddingStore(com.mongodb.client.MongoClient mongoClient, String connectionString, String databaseName, String collectionName, String indexName, String applicationName, com.mongodb.client.model.CreateCollectionOptions createCollectionOptions, Boolean createIndex, String kind, Integer numLists, Integer dimensions, Integer m, Integer efConstruction, Integer efSearch) - Parameters:
mongoClient- - mongoClient for the Azure CosmosDB Mongo vCoreconnectionString- - connection string required to connect to Azure Cosmos Mongo vCoredatabaseName- - databaseName for the mongoDb vCorecollectionName- - collection name for the mongoDB vCoreindexName- - index name for the mongoDB vCore collectionapplicationName- - application name for the client for tracking and loggingcreateCollectionOptions- - options for creating a collectioncreateIndex- - set to true if you want the application to create an index, or false if you want to create it manually.kind- - Type of vector index to create. Possible options are: - vector-ivf - vector-hnsw: available as a preview feature only, to enable visit https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/preview-featuresnumLists- - This integer is the number of clusters that the inverted file (IVF) index uses to group the vector data. We recommend that numLists is set to documentCount/1000 for up to 1 million documents and to sqrt(documentCount) for more than 1 million documents. Using a numLists value of 1 is akin to performing brute-force search, which has limited performance.dimensions- - Number of dimensions for vector similarity. The maximum number of supported dimensions is 2000.m- - used only for vector -hnsw. The max number of connections per layer (16 by default, minimum value is 2, maximum value is 100). Higher m is suitable for datasets with high dimensionality and/or high accuracy requirements.efConstruction- - used only for vector -hnsw. The size of the dynamic candidate list for constructing the graph (64 by default, minimum value is 4, maximum value is 1000). Higher ef_construction will result in better index quality and higher accuracy, but it will also increase the time required to build the index. ef_construction has to be at least 2 * m.efSearch- - used only for vector -hnsw. The size of the dynamic candidate list for search (40 by default). A higher value provides better recall at the cost of speed.
-
-
Method Details
-
builder
-
add
- Specified by:
addin interfacedev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
-
add
- Specified by:
addin interfacedev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
-
add
public String add(dev.langchain4j.data.embedding.Embedding embedding, dev.langchain4j.data.segment.TextSegment textSegment) - Specified by:
addin interfacedev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
-
addAll
- Specified by:
addAllin interfacedev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
-
addAll
public List<String> addAll(List<dev.langchain4j.data.embedding.Embedding> embeddings, List<dev.langchain4j.data.segment.TextSegment> embedded) - Specified by:
addAllin interfacedev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
-
findRelevant
public List<dev.langchain4j.store.embedding.EmbeddingMatch<dev.langchain4j.data.segment.TextSegment>> findRelevant(dev.langchain4j.data.embedding.Embedding referenceEmbedding, int maxResults, double minScore) - Specified by:
findRelevantin interfacedev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
-