Class PostgresPlugin
java.lang.Object
com.google.genkit.plugins.postgresql.PostgresPlugin
- All Implemented Interfaces:
Plugin
PostgreSQL plugin for Genkit providing vector database functionality using
pgvector.
Example usage:
Genkit genkit = Genkit
.builder().plugin(
GoogleGenAIPlugin.create(apiKey))
.plugin(PostgresPlugin.builder().connectionString("jdbc:postgresql://localhost:5432/mydb").username("user")
.password("pass").addTable(PostgresTableConfig.builder().tableName("documents")
.embedderName("googleai/text-embedding-004").build())
.build())
.build();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic PostgresPlugin.Builderbuilder()Creates a new builder for PostgresPlugin.voidclose()Closes the plugin and releases resources.getName()Returns the unique identifier for the plugin.getVectorStore(String tableName) Gets a vector store by table name.init()Initializes the plugin.Initializes the plugin with access to the registry.
-
Method Details
-
builder
Creates a new builder for PostgresPlugin. -
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). -
getVectorStore
Gets a vector store by table name.- Parameters:
tableName- the table name- Returns:
- the vector store, or null if not found
-
close
public void close()Closes the plugin and releases resources.
-