UNPKG

@agenite/anthropic

Version:
50 lines (46 loc) 1.68 kB
import { BaseLLMConfig, ToolDefinition, BaseLLMProvider, BaseMessage, GenerateOptions, GenerateResponse, PartialReturn, IterateGenerateOptions } from '@agenite/llm'; /** * Available Claude model versions */ type AnthropicModel = "claude-3-opus-20240229" | "claude-3-sonnet-20240229" | "claude-3-haiku-20240229" | "claude-2.1" | "claude-2.0" | "claude-instant-1.2"; /** * Anthropic-specific configuration options */ interface AnthropicConfig extends BaseLLMConfig { apiKey: string; /** * Base URL for the Anthropic API */ baseURL?: string; /** * Model to use for the Anthropic API */ model?: AnthropicModel; /** * System prompt to be prepended to all messages */ systemPrompt?: string; /** * Tool definitions in Anthropic format */ tools?: ToolDefinition[]; /** * Additional metadata for requests */ metadata?: Record<string, unknown>; /** * Maximum number of retries for failed requests */ maxRetries?: number; } declare class AnthropicProvider extends BaseLLMProvider { private client; private model; readonly name = "Claude"; readonly version = "3"; constructor(config: AnthropicConfig); generate(input: string | BaseMessage[], options?: Partial<GenerateOptions>): Promise<GenerateResponse>; stream(input: string | BaseMessage[], options?: Partial<GenerateOptions>): AsyncGenerator<PartialReturn, GenerateResponse, unknown>; iterate(input: string | BaseMessage[], options: IterateGenerateOptions): AsyncGenerator<PartialReturn, GenerateResponse, unknown>; } export { type AnthropicConfig, type AnthropicModel, AnthropicProvider };