Class MilvusEmbeddingStore.Builder

java.lang.Object
dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.Builder
Enclosing class:
MilvusEmbeddingStore

public static class MilvusEmbeddingStore.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • milvusClient

      public MilvusEmbeddingStore.Builder milvusClient(io.milvus.client.MilvusServiceClient milvusClient)
    • host

      Parameters:
      host - The host of the self-managed Milvus instance. Default value: "localhost".
      Returns:
      builder
    • port

      Parameters:
      port - The port of the self-managed Milvus instance. Default value: 19530.
      Returns:
      builder
    • collectionName

      public MilvusEmbeddingStore.Builder collectionName(String collectionName)
      Parameters:
      collectionName - The name of the Milvus collection. If there is no such collection yet, it will be created automatically. Default value: "default".
      Returns:
      builder
    • dimension

      public MilvusEmbeddingStore.Builder dimension(Integer dimension)
      Parameters:
      dimension - The dimension of the embedding vector. (e.g. 384) Mandatory if a new collection should be created.
      Returns:
      builder
    • indexType

      public MilvusEmbeddingStore.Builder indexType(io.milvus.param.IndexType indexType)
      Parameters:
      indexType - The type of the index. Default value: FLAT.
      Returns:
      builder
    • metricType

      public MilvusEmbeddingStore.Builder metricType(io.milvus.param.MetricType metricType)
      Parameters:
      metricType - The type of the metric used for similarity search. Default value: COSINE.
      Returns:
      builder
    • uri

      Parameters:
      uri - The URI of the managed Milvus instance. (e.g. "https://xxx.api.gcp-us-west1.zillizcloud.com")
      Returns:
      builder
    • token

      public MilvusEmbeddingStore.Builder token(String token)
      Parameters:
      token - The token (API key) of the managed Milvus instance.
      Returns:
      builder
    • username

      public MilvusEmbeddingStore.Builder username(String username)
      Parameters:
      username - The username. See details here.
      Returns:
      builder
    • password

      public MilvusEmbeddingStore.Builder password(String password)
      Parameters:
      password - The password. See details here.
      Returns:
      builder
    • consistencyLevel

      public MilvusEmbeddingStore.Builder consistencyLevel(io.milvus.common.clientenum.ConsistencyLevelEnum consistencyLevel)
      Parameters:
      consistencyLevel - The consistency level used by Milvus. Default value: EVENTUALLY.
      Returns:
      builder
    • retrieveEmbeddingsOnSearch

      public MilvusEmbeddingStore.Builder retrieveEmbeddingsOnSearch(Boolean retrieveEmbeddingsOnSearch)
      Parameters:
      retrieveEmbeddingsOnSearch - During a similarity search in Milvus (when calling findRelevant()), the embedding itself is not retrieved. To retrieve the embedding, an additional query is required. Setting this parameter to "true" will ensure that embedding is retrieved. Be aware that this will impact the performance of the search. Default value: false.
      Returns:
      builder
    • autoFlushOnInsert

      public MilvusEmbeddingStore.Builder autoFlushOnInsert(Boolean autoFlushOnInsert)
      Parameters:
      autoFlushOnInsert - Whether to automatically flush after each insert (add(...) or addAll(...) methods). Default value: false. More info can be found here.
      Returns:
      builder
    • databaseName

      public MilvusEmbeddingStore.Builder databaseName(String databaseName)
      Parameters:
      databaseName - Milvus name of database. Default value: null. In this case default Milvus database name will be used.
      Returns:
      builder
    • idFieldName

      public MilvusEmbeddingStore.Builder idFieldName(String idFieldName)
      Parameters:
      idFieldName - the name of the field where the ID of the Embedding is stored. Default value: "id".
      Returns:
      builder
    • textFieldName

      public MilvusEmbeddingStore.Builder textFieldName(String textFieldName)
      Parameters:
      textFieldName - the name of the field where the text of the TextSegment is stored. Default value: "text".
      Returns:
      builder
    • metadataFieldName

      public MilvusEmbeddingStore.Builder metadataFieldName(String metadataFieldName)
      Parameters:
      metadataFieldName - the name of the field where the Metadata of the TextSegment is stored. Default value: "metadata".
      Returns:
      builder
    • vectorFieldName

      public MilvusEmbeddingStore.Builder vectorFieldName(String vectorFieldName)
      Parameters:
      vectorFieldName - the name of the field where the Embedding is stored. Default value: "vector".
      Returns:
      builder
    • build

      public MilvusEmbeddingStore build()