Class MongoPlugin
java.lang.Object
com.google.genkit.plugins.mongodb.MongoPlugin
- All Implemented Interfaces:
Plugin
MongoDB Atlas Vector Search plugin for Genkit.
Registers a retriever and indexer named mongodb/<collectionName> for each configured
collection, backed by an Atlas Vector Search index. Requires MongoDB Atlas or the
mongodb/mongodb-atlas-local Docker image (a plain MongoDB server does not support
$vectorSearch).
Example usage:
Genkit genkit = Genkit.builder()
.plugin(GoogleGenAIPlugin.create(apiKey))
.plugin(
MongoPlugin.builder()
.connectionString("mongodb://localhost:27017/?directConnection=true")
.addCollection(
MongoVectorStoreConfig.builder()
.collectionName("films")
.embedderName("googleai/gemini-embedding-001")
.dimension(768)
.createIndexIfNotExists(true)
.build())
.build())
.build();
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe plugin name; used as themongodb/...action prefix. -
Method Summary
Modifier and TypeMethodDescriptionstatic MongoPlugin.Builderbuilder()Creates a new builder.getName()Returns the unique identifier for the plugin.init()Initializes the plugin.Initializes the plugin with access to the registry.
-
Field Details
-
PLUGIN_NAME
The plugin name; used as themongodb/...action prefix.- See Also:
-
-
Method Details
-
builder
Creates a new builder.- Returns:
- a new builder
-
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).
-