Class AzureDocumentDbEmbeddingStore.Builder
java.lang.Object
dev.langchain4j.store.embedding.azure.documentdb.AzureDocumentDbEmbeddingStore.Builder
- Enclosing class:
AzureDocumentDbEmbeddingStore
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplicationName(String applicationName) build()collectionName(String collectionName) connectionString(String connectionString) Sets the Azure DocumentDB connectionString.createCollectionOptions(com.mongodb.client.model.CreateCollectionOptions createCollectionOptions) createIndex(Boolean createIndex) Set to true if you want the application to create an index, or false if you want to create it manually.databaseName(String databaseName) dimensions(Integer dimensions) Sets the number of embedding dimensions.efConstruction(Integer efConstruction) Sets the required vector index type for index creation and search.Sets the required vector index type for index creation and search.mongoClient(com.mongodb.client.MongoClient mongoClient) Sets a caller-owned MongoClient.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
mongoClient
public AzureDocumentDbEmbeddingStore.Builder mongoClient(com.mongodb.client.MongoClient mongoClient) Sets a caller-owned MongoClient. The caller is responsible for closing it; closing the store does not close this client. Takes precedence over connectionString when both are provided. -
connectionString
Sets the Azure DocumentDB connectionString. This is a mandatory parameter if not providing the Mongo Client. The store owns the client created from this connection string. Close the store to release its resources.- Parameters:
connectionString- The Azure DocumentDB connectionString.- Returns:
- builder
-
databaseName
-
collectionName
-
indexName
-
applicationName
-
createCollectionOptions
public AzureDocumentDbEmbeddingStore.Builder createCollectionOptions(com.mongodb.client.model.CreateCollectionOptions createCollectionOptions) -
createIndex
Set to true if you want the application to create an index, or false if you want to create it manually.default value is false
When true,dimensions(Integer)must also be configured.- Parameters:
createIndex- whether to create the vector index if it is missing- Returns:
- builder
-
kind
Sets the required vector index type for index creation and search.- Parameters:
kind-vector-ivforvector-hnsw- Returns:
- builder
-
kind
public AzureDocumentDbEmbeddingStore.Builder kind(AzureDocumentDbEmbeddingStore.VectorIndexType kind) Sets the required vector index type for index creation and search. HNSW requires an M30 or higher Azure DocumentDB cluster tier.- Parameters:
kind- the vector index type- Returns:
- builder
-
numLists
- Parameters:
numLists- - 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.- Returns:
- builder
-
dimensions
Sets the number of embedding dimensions. Required whencreateIndex(Boolean)is true.- Parameters:
dimensions- a positive value matching the embedding model's output dimensions- Returns:
- builder
-
m
- Parameters:
m- - 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.- Returns:
- builder
-
efConstruction
- Parameters:
efConstruction- - 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.- Returns:
- builder
-
efSearch
- Parameters:
efSearch- - The size of the dynamic candidate list for search (40 by default). A higher value provides better recall at the cost of speed.- Returns:
- builder
-
build
-