Class FirestoreRetrieverConfig

java.lang.Object
com.google.genkit.plugins.firebase.retriever.FirestoreRetrieverConfig

public class FirestoreRetrieverConfig extends Object
Configuration for a Firestore vector search retriever.

Example:


 FirestoreRetrieverConfig config = FirestoreRetrieverConfig.builder().name("my-docs").collection("documents")
 		.embedderName("googleai/text-embedding-004").vectorField("embedding").contentField("content")
 		.distanceMeasure(DistanceMeasure.COSINE).build();
 
  • Method Details

    • builder

      public static FirestoreRetrieverConfig.Builder builder()
      Creates a builder for FirestoreRetrieverConfig.
      Returns:
      a new builder
    • getName

      public String getName()
    • getLabel

      public String getLabel()
    • getCollection

      public String getCollection()
    • getVectorField

      public String getVectorField()
    • getContentField

      public String getContentField()
    • getContentExtractor

      public Function<com.google.cloud.firestore.QueryDocumentSnapshot,List<Part>> getContentExtractor()
    • getDistanceMeasure

      public FirestoreRetrieverConfig.DistanceMeasure getDistanceMeasure()
    • getDistanceThreshold

      public Double getDistanceThreshold()
    • getDistanceResultField

      public String getDistanceResultField()
    • getEmbedder

      public Embedder getEmbedder()
    • getEmbedderName

      public String getEmbedderName()
    • getMetadataFields

      public List<String> getMetadataFields()
    • getMetadataExtractor

      public Function<com.google.cloud.firestore.QueryDocumentSnapshot,Map<String,Object>> getMetadataExtractor()
    • getDefaultLimit

      public int getDefaultLimit()
    • isCreateDatabaseIfNotExists

      public boolean isCreateDatabaseIfNotExists()
      Returns whether to create the database if it doesn't exist.
      Returns:
      true if the database should be created automatically
    • getDatabaseId

      public String getDatabaseId()
      Returns the Firestore database ID.
      Returns:
      the database ID, or "(default)" if not specified
    • isCreateVectorIndexIfNotExists

      public boolean isCreateVectorIndexIfNotExists()
      Returns whether to create the vector index if it doesn't exist.
      Returns:
      true if the vector index should be created automatically
    • getEmbedderDimension

      public int getEmbedderDimension()
      Returns the embedder dimension for vector index creation.
      Returns:
      the embedder dimension, defaults to 768 if not specified