Package com.google.genkit.plugins.ollama
Class OllamaPlugin
java.lang.Object
com.google.genkit.plugins.ollama.OllamaPlugin
- All Implemented Interfaces:
Plugin
OllamaPlugin provides local Ollama model integrations for Genkit.
This plugin registers Ollama models running locally (or at a configured host)
as Genkit actions for text generation with support for streaming.
Ollama must be installed and running. Install from: https://ollama.ai
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an OllamaPlugin with default options.OllamaPlugin(OllamaPluginOptions options) Creates an OllamaPlugin with the specified options. -
Method Summary
Modifier and TypeMethodDescriptionstatic OllamaPlugincreate()Creates an OllamaPlugin using default settings.static OllamaPluginCreates an OllamaPlugin with the specified base URL.static OllamaPluginCreates an OllamaPlugin with the specified models.getName()Returns the unique identifier for the plugin.Gets the plugin options.init()Initializes the plugin.
-
Constructor Details
-
OllamaPlugin
public OllamaPlugin()Creates an OllamaPlugin with default options. Uses localhost:11434 and registers common models. -
OllamaPlugin
Creates an OllamaPlugin with the specified options.- Parameters:
options- the plugin options
-
-
Method Details
-
create
Creates an OllamaPlugin with the specified base URL.- Parameters:
baseUrl- the Ollama server URL (e.g., "http://localhost:11434")- Returns:
- a new OllamaPlugin
-
create
Creates an OllamaPlugin with the specified models.- Parameters:
models- the models to register- Returns:
- a new OllamaPlugin
-
create
Creates an OllamaPlugin using default settings. Uses OLLAMA_HOST environment variable or localhost:11434.- Returns:
- a new OllamaPlugin
-
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
-