Class AzureDocumentDbEmbeddingStore.Builder

java.lang.Object
dev.langchain4j.store.embedding.azure.documentdb.AzureDocumentDbEmbeddingStore.Builder
Enclosing class:
AzureDocumentDbEmbeddingStore

public static class AzureDocumentDbEmbeddingStore.Builder extends Object
  • 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

      public AzureDocumentDbEmbeddingStore.Builder connectionString(String 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

      public AzureDocumentDbEmbeddingStore.Builder databaseName(String databaseName)
    • collectionName

      public AzureDocumentDbEmbeddingStore.Builder collectionName(String collectionName)
    • indexName

      public AzureDocumentDbEmbeddingStore.Builder indexName(String indexName)
    • applicationName

      public AzureDocumentDbEmbeddingStore.Builder applicationName(String applicationName)
    • createCollectionOptions

      public AzureDocumentDbEmbeddingStore.Builder createCollectionOptions(com.mongodb.client.model.CreateCollectionOptions createCollectionOptions)
    • createIndex

      public AzureDocumentDbEmbeddingStore.Builder createIndex(Boolean 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-ivf or vector-hnsw
      Returns:
      builder
    • 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

      public AzureDocumentDbEmbeddingStore.Builder numLists(Integer 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

      public AzureDocumentDbEmbeddingStore.Builder dimensions(Integer dimensions)
      Sets the number of embedding dimensions. Required when createIndex(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

      public AzureDocumentDbEmbeddingStore.Builder efConstruction(Integer 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

      public AzureDocumentDbEmbeddingStore.Builder efSearch(Integer 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