Class MongoVectorStoreConfig

java.lang.Object
com.google.genkit.plugins.mongodb.MongoVectorStoreConfig

public final class MongoVectorStoreConfig extends Object
Configuration for a single MongoDB Atlas Vector Search collection managed by MongoPlugin.

Each config registers a retriever and indexer named mongodb/<collectionName> backed by an Atlas Vector Search index over the embedding field.

  • Method Details

    • getDatabaseName

      public String getDatabaseName()
      Returns the database name (default genkit).
      Returns:
      the database name
    • getCollectionName

      public String getCollectionName()
      Returns the collection name.
      Returns:
      the collection name
    • getEmbedderName

      public String getEmbedderName()
      Returns the name of the embedder used to vectorize documents and queries.
      Returns:
      the embedder name
    • getIndexName

      public String getIndexName()
      Returns the Atlas Vector Search index name (default genkit_vector_index).
      Returns:
      the index name
    • getDimension

      public int getDimension()
      Returns the embedding dimension (default 768).
      Returns:
      the embedding dimension
    • getSimilarity

      public MongoVectorStoreConfig.Similarity getSimilarity()
      Returns the vector similarity function (default MongoVectorStoreConfig.Similarity.COSINE).
      Returns:
      the similarity
    • getTextField

      public String getTextField()
      Returns the field that stores the document text (default text).
      Returns:
      the text field name
    • getEmbeddingField

      public String getEmbeddingField()
      Returns the field that stores the embedding vector (default embedding).
      Returns:
      the embedding field name
    • getNumCandidates

      public int getNumCandidates()
      Returns the number of nearest neighbors to consider during the vector search (default 100). Atlas recommends a value at least 10× the requested result count.
      Returns:
      the number of candidates
    • isCreateIndexIfNotExists

      public boolean isCreateIndexIfNotExists()
      Returns whether to create the Atlas Vector Search index on first use if it does not exist (default false).
      Returns:
      true if the index should be created when missing
    • getAdditionalMetadata

      public Map<String,Object> getAdditionalMetadata()
      Returns additional metadata merged into every indexed document.
      Returns:
      the additional metadata
    • builder

      public static MongoVectorStoreConfig.Builder builder()
      Creates a new builder.
      Returns:
      a new builder