Class AnthropicPlugin
java.lang.Object
com.google.genkit.plugins.anthropic.AnthropicPlugin
- All Implemented Interfaces:
Plugin
AnthropicPlugin provides Anthropic Claude model integrations for Genkit.
This plugin registers Claude models (Claude 5, Claude 4, and Claude 3.5 families) as Genkit actions for text generation with support for streaming.
-
Field Summary
FieldsModifier and TypeFieldDescriptionSupported Claude models. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an AnthropicPlugin with default options.AnthropicPlugin(AnthropicPluginOptions options) Creates an AnthropicPlugin with the specified options. -
Method Summary
Modifier and TypeMethodDescriptionstatic AnthropicPlugincreate()Creates an AnthropicPlugin using the ANTHROPIC_API_KEY environment variable.static AnthropicPluginCreates an AnthropicPlugin with the specified API key.customModel(String modelName) Registers a custom model name.getName()Returns the unique identifier for the plugin.Gets the plugin options.init()Initializes the plugin.
-
Field Details
-
SUPPORTED_MODELS
Supported Claude models.
-
-
Constructor Details
-
AnthropicPlugin
public AnthropicPlugin()Creates an AnthropicPlugin with default options. -
AnthropicPlugin
Creates an AnthropicPlugin with the specified options.- Parameters:
options- the plugin options
-
-
Method Details
-
create
Creates an AnthropicPlugin with the specified API key.- Parameters:
apiKey- the Anthropic API key- Returns:
- a new AnthropicPlugin
-
create
Creates an AnthropicPlugin using the ANTHROPIC_API_KEY environment variable.- Returns:
- a new AnthropicPlugin
-
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. -
customModel
Registers a custom model name. Use this to work with models not in the default list. Call this method before passing the plugin to Genkit.builder().- Parameters:
modelName- the model name (e.g., "claude-4-opus-20260101")- Returns:
- this plugin instance for method chaining
-
getOptions
Gets the plugin options.- Returns:
- the options
-