Class MongoVectorStoreConfig.Builder

java.lang.Object
com.google.genkit.plugins.mongodb.MongoVectorStoreConfig.Builder
Enclosing class:
MongoVectorStoreConfig

public static final class MongoVectorStoreConfig.Builder extends Object
  • Method Details

    • databaseName

      public MongoVectorStoreConfig.Builder databaseName(String databaseName)
      Sets the database name.
      Parameters:
      databaseName - the database name
      Returns:
      this builder
    • collectionName

      public MongoVectorStoreConfig.Builder collectionName(String collectionName)
      Sets the collection name.
      Parameters:
      collectionName - the collection name
      Returns:
      this builder
    • embedderName

      public MongoVectorStoreConfig.Builder embedderName(String embedderName)
      Sets the embedder name.
      Parameters:
      embedderName - the embedder name
      Returns:
      this builder
    • indexName

      public MongoVectorStoreConfig.Builder indexName(String indexName)
      Sets the Atlas Vector Search index name.
      Parameters:
      indexName - the index name
      Returns:
      this builder
    • dimension

      public MongoVectorStoreConfig.Builder dimension(int dimension)
      Sets the embedding dimension.
      Parameters:
      dimension - the embedding dimension (must be >= 1)
      Returns:
      this builder
    • similarity

      Sets the vector similarity function.
      Parameters:
      similarity - the similarity
      Returns:
      this builder
    • textField

      public MongoVectorStoreConfig.Builder textField(String textField)
      Sets the text field name.
      Parameters:
      textField - the text field name
      Returns:
      this builder
    • embeddingField

      public MongoVectorStoreConfig.Builder embeddingField(String embeddingField)
      Sets the embedding field name.
      Parameters:
      embeddingField - the embedding field name
      Returns:
      this builder
    • numCandidates

      public MongoVectorStoreConfig.Builder numCandidates(int numCandidates)
      Sets the number of nearest neighbors to consider during the vector search.
      Parameters:
      numCandidates - the number of candidates (must be >= 1)
      Returns:
      this builder
    • createIndexIfNotExists

      public MongoVectorStoreConfig.Builder createIndexIfNotExists(boolean createIndexIfNotExists)
      Sets whether to create the Atlas Vector Search index on first use if it does not exist.
      Parameters:
      createIndexIfNotExists - whether to create the index when missing
      Returns:
      this builder
    • addAdditionalMetadata

      public MongoVectorStoreConfig.Builder addAdditionalMetadata(String key, Object value)
      Adds a metadata entry merged into every indexed document.
      Parameters:
      key - the metadata key
      value - the metadata value
      Returns:
      this builder
    • build

      public MongoVectorStoreConfig build()
      Builds a new MongoVectorStoreConfig.
      Returns:
      a new config instance