Class OllamaPlugin

java.lang.Object
com.google.genkit.plugins.ollama.OllamaPlugin
All Implemented Interfaces:
Plugin

public class OllamaPlugin extends Object implements 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 Details

    • OllamaPlugin

      public OllamaPlugin()
      Creates an OllamaPlugin with default options. Uses localhost:11434 and registers common models.
    • OllamaPlugin

      public OllamaPlugin(OllamaPluginOptions options)
      Creates an OllamaPlugin with the specified options.
      Parameters:
      options - the plugin options
  • Method Details

    • create

      public static OllamaPlugin create(String baseUrl)
      Creates an OllamaPlugin with the specified base URL.
      Parameters:
      baseUrl - the Ollama server URL (e.g., "http://localhost:11434")
      Returns:
      a new OllamaPlugin
    • create

      public static OllamaPlugin create(String... models)
      Creates an OllamaPlugin with the specified models.
      Parameters:
      models - the models to register
      Returns:
      a new OllamaPlugin
    • create

      public static OllamaPlugin create()
      Creates an OllamaPlugin using default settings. Uses OLLAMA_HOST environment variable or localhost:11434.
      Returns:
      a new OllamaPlugin
    • getName

      public String getName()
      Description copied from interface: Plugin
      Returns the unique identifier for the plugin. This name is used for registration and lookup.
      Specified by:
      getName in interface Plugin
      Returns:
      the plugin name
    • init

      public List<Action<?,?,?>> init()
      Description copied from interface: Plugin
      Initializes the plugin. This method is called once during Genkit initialization. The plugin should return a list of actions that it provides.
      Specified by:
      init in interface Plugin
      Returns:
      list of actions provided by this plugin
    • getOptions

      public OllamaPluginOptions getOptions()
      Gets the plugin options.
      Returns:
      the options