genkitx-anthropic
Version:
Firebase Genkit AI framework plugin for Anthropic APIs.
44 lines (41 loc) • 1.96 kB
TypeScript
import * as genkit_plugin from 'genkit/plugin';
export { claude35Haiku, claude35Sonnet, claude37Sonnet, claude3Haiku, claude3Opus, claude3Sonnet } from './claude.js';
import 'genkit';
import 'genkit/model';
import '@anthropic-ai/sdk';
import '@anthropic-ai/sdk/resources/messages.mjs';
interface PluginOptions {
apiKey?: string;
cacheSystemPrompt?: boolean;
}
/**
* This module provides an interface to the Anthropic AI models through the Genkit plugin system.
* It allows users to interact with various Claude models by providing an API key and optional configuration.
*
* The main export is the `anthropic` plugin, which can be configured with an API key either directly or through
* environment variables. It initializes the Anthropic client and makes available the Claude models for use.
*
* Exports:
* - claude35Sonnet: Reference to the Claude 3.5 Sonnet model.
* - claude3Haiku: Reference to the Claude 3 Haiku model.
* - claude3Sonnet: Reference to the Claude 3 Sonnet model.
* - claude3Opus: Reference to the Claude 3 Opus model.
* - anthropic: The main plugin function to interact with the Anthropic AI.
*
* Usage:
* To use the Claude models, initialize the anthropic plugin inside `configureGenkit` and pass the configuration options. If no API key is provided in the options, the environment variable `ANTHROPIC_API_KEY` must be set. If you want to cache the system prompt, set `cacheSystemPrompt` to `true`. **Note:** Prompt caching is in beta and may change. To learn more, see https://docs.anthropic.com/en/docs/prompt-caching.
*
* Example:
* ```
* import anthropic from 'genkitx-anthropic';
*
* export default configureGenkit({
* plugins: [
* anthropic({ apiKey: 'your-api-key', cacheSystemPrompt: false })
* ... // other plugins
* ]
* });
* ```
*/
declare const anthropic: (options?: PluginOptions) => genkit_plugin.GenkitPlugin;
export { type PluginOptions, anthropic, anthropic as default };