Class FirebasePlugin

java.lang.Object
com.google.genkit.plugins.firebase.FirebasePlugin
All Implemented Interfaces:
Plugin

public class FirebasePlugin extends Object implements Plugin
Firebase plugin for Genkit providing integration with Firebase services.

This plugin provides:

  • Firestore vector search for RAG (Retrieval Augmented Generation)
  • Firebase Cloud Functions integration for deploying flows
  • Firebase telemetry for Google Cloud observability

Example usage:


 Genkit genkit = Genkit.builder().plugin(GoogleGenAIPlugin.create(apiKey))
 		.plugin(FirebasePlugin.builder().projectId("my-project").enableTelemetry(true)
 				.addRetriever(FirestoreRetrieverConfig.builder().name("my-docs").collection("documents")
 						.embedderName("googleai/text-embedding-004").vectorField("embedding").contentField("content")
 						.build())
 				.build())
 		.build();
 
  • Field Details

  • Method Details

    • builder

      public static FirebasePlugin.Builder builder()
      Creates a builder for FirebasePlugin.
      Returns:
      a new builder
    • create

      public static FirebasePlugin create(String projectId)
      Creates a simple FirebasePlugin with just the project ID.
      Parameters:
      projectId - the Firebase project ID
      Returns:
      a new FirebasePlugin
    • getName

      public String getName()
      Description copied from interface: Plugin
      Returns the unique identifier for the plugin. This name is used for registration and lookup.
      Specified by:
      getName in interface Plugin
      Returns:
      the plugin name
    • init

      public List<Action<?,?,?>> init()
      Description copied from interface: Plugin
      Initializes the plugin. This method is called once during Genkit initialization. The plugin should return a list of actions that it provides.
      Specified by:
      init in interface Plugin
      Returns:
      list of actions provided by this plugin
    • init

      public List<Action<?,?,?>> init(Registry registry)
      Description copied from interface: Plugin
      Initializes the plugin with access to the registry. This method is called once during Genkit initialization. The plugin should return a list of actions that it provides.

      Override this method instead of Plugin.init() when your plugin needs to resolve dependencies from the registry (e.g., embedders, models).

      Specified by:
      init in interface Plugin
      Parameters:
      registry - the Genkit registry for resolving dependencies
      Returns:
      list of actions provided by this plugin
    • getFirestore

      public com.google.cloud.firestore.Firestore getFirestore()
      Gets the Firestore instance.
      Returns:
      the Firestore instance
    • getFirebaseApp

      public com.google.firebase.FirebaseApp getFirebaseApp()
      Gets the FirebaseApp instance.
      Returns:
      the FirebaseApp instance
    • getTelemetry

      public FirebaseTelemetry getTelemetry()
      Gets the Firebase telemetry instance.
      Returns:
      the telemetry instance, or null if not enabled