Class CompatOAIPlugin
java.lang.Object
com.google.genkit.plugins.compatoai.CompatOAIPlugin
- All Implemented Interfaces:
Plugin
CompatOAIPlugin provides a generic OpenAI-compatible API integration for
Genkit.
This plugin allows you to use any OpenAI-compatible API endpoint by
configuring the base URL and providing model definitions. Useful for: -
Custom or self-hosted OpenAI-compatible endpoints - New providers before
dedicated plugins are available - Testing and experimentation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for CompatOAIPlugin.static classModel definition for a compat-oai model. -
Constructor Summary
ConstructorsConstructorDescriptionCompatOAIPlugin(String pluginName, CompatOAIPluginOptions options, List<CompatOAIPlugin.ModelDefinition> models) Creates a CompatOAIPlugin with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionstatic CompatOAIPlugin.Builderbuilder()Creates a CompatOAIPlugin builder.getName()Returns the unique identifier for the plugin.Gets the plugin options.init()Initializes the plugin.
-
Constructor Details
-
CompatOAIPlugin
public CompatOAIPlugin(String pluginName, CompatOAIPluginOptions options, List<CompatOAIPlugin.ModelDefinition> models) Creates a CompatOAIPlugin with the specified configuration.- Parameters:
pluginName- the plugin name (e.g., "my-provider")options- the plugin options (API key, base URL, etc.)models- the list of models to register
-
-
Method Details
-
builder
Creates a CompatOAIPlugin 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. -
getOptions
Gets the plugin options.- Returns:
- the options
-