Class FirebasePlugin
java.lang.Object
com.google.genkit.plugins.firebase.FirebasePlugin
- All Implemented Interfaces:
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();
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic FirebasePlugin.Builderbuilder()Creates a builder for FirebasePlugin.static FirebasePluginCreates a simple FirebasePlugin with just the project ID.com.google.firebase.FirebaseAppGets the FirebaseApp instance.com.google.cloud.firestore.FirestoreGets the Firestore instance.getName()Returns the unique identifier for the plugin.Gets the Firebase telemetry instance.init()Initializes the plugin.Initializes the plugin with access to the registry.
-
Field Details
-
PROVIDER
- See Also:
-
-
Method Details
-
builder
Creates a builder for FirebasePlugin.- Returns:
- a new builder
-
create
Creates a simple FirebasePlugin with just the project ID.- Parameters:
projectId- the Firebase project ID- Returns:
- a new FirebasePlugin
-
getName
Description copied from interface:PluginReturns the unique identifier for the plugin. This name is used for registration and lookup. -
init
Description copied from interface:PluginInitializes the plugin. This method is called once during Genkit initialization. The plugin should return a list of actions that it provides. -
init
Description copied from interface:PluginInitializes 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). -
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
Gets the Firebase telemetry instance.- Returns:
- the telemetry instance, or null if not enabled
-