import { Anthropic } from "@anthropic-ai/sdk"; import type { CompletionCreateParams } from "@anthropic-ai/sdk/resources/completions"; import { CallbackManagerForLLMRun } from "../callbacks/manager.js"; import { BaseMessage, ChatGenerationChunk, ChatResult } from "../schema/index.js"; import { BaseChatModel, BaseChatModelParams } from "./base.js"; /** * Input to AnthropicChat class. */ export interface AnthropicInput { /** Amount of randomness injected into the response. Ranges * from 0 to 1. Use temp closer to 0 for analytical / * multiple choice, and temp closer to 1 for creative * and generative tasks. */ temperature?: number; /** Only sample from the top K options for each subsequent * token. Used to remove "long tail" low probability * responses. Defaults to -1, which disables it. */ topK?: number; /** Does nucleus sampling, in which we compute the * cumulative distribution over all the options for each * subsequent token in decreasing probability order and * cut it off once it reaches a particular probability * specified by top_p. Defaults to -1, which disables it. * Note that you should either alter temperature or top_p, * but not both. */ topP?: number; /** A maximum number of tokens to generate before stopping. */ maxTokensToSample: number; /** A list of strings upon which to stop generating. * You probably want `["\n\nHuman:"]`, as that's the cue for * the next turn in the dialog agent. */ stopSequences?: string[]; /** Whether to stream the results or not */ streaming?: boolean; /** Anthropic API key */ anthropicApiKey?: string; /** Anthropic API URL */ anthropicApiUrl?: string; /** Model name to use */ modelName: string; /** Holds any additional parameters that are valid to pass to {@link * https://console.anthropic.com/docs/api/reference | * `anthropic.complete`} that are not explicitly specified on this class. */ invocationKwargs?: Kwargs; } type Kwargs = Record; /** * Wrapper around Anthropic large language models. * * To use you should have the `@anthropic-ai/sdk` package installed, with the * `ANTHROPIC_API_KEY` environment variable set. * * @remarks * Any parameters that are valid to be passed to {@link * https://console.anthropic.com/docs/api/reference | * `anthropic.complete`} can be passed through {@link invocationKwargs}, * even if not explicitly available on this class. * */ export declare class ChatAnthropic extends BaseChatModel implements AnthropicInput { get lc_secrets(): { [key: string]: string; } | undefined; get lc_aliases(): Record; lc_serializable: boolean; anthropicApiKey?: string; apiUrl?: string; temperature: number; topK: number; topP: number; maxTokensToSample: number; modelName: string; invocationKwargs?: Kwargs; stopSequences?: string[]; streaming: boolean; private batchClient; private streamingClient; constructor(fields?: Partial & BaseChatModelParams); /** * Get the parameters used to invoke the model */ invocationParams(options?: this["ParsedCallOptions"]): Omit & Kwargs; /** @ignore */ _identifyingParams(): { metadata?: Anthropic.Completions.CompletionCreateParams.CompletionRequestNonStreaming.Metadata | Anthropic.Completions.CompletionCreateParams.CompletionRequestStreaming.Metadata | undefined; stream?: boolean | undefined; model: (string & {}) | "claude-2" | "claude-instant-1"; temperature?: number | undefined; top_p?: number | undefined; top_k?: number | undefined; max_tokens_to_sample: number; stop_sequences?: string[] | undefined; model_name: string; }; /** * Get the identifying parameters for the model */ identifyingParams(): { metadata?: Anthropic.Completions.CompletionCreateParams.CompletionRequestNonStreaming.Metadata | Anthropic.Completions.CompletionCreateParams.CompletionRequestStreaming.Metadata | undefined; stream?: boolean | undefined; model: (string & {}) | "claude-2" | "claude-instant-1"; temperature?: number | undefined; top_p?: number | undefined; top_k?: number | undefined; max_tokens_to_sample: number; stop_sequences?: string[] | undefined; model_name: string; }; _streamResponseChunks(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): AsyncGenerator; private formatMessagesAsPrompt; /** @ignore */ _generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise; private createStreamWithRetry; /** @ignore */ private completionWithRetry; _llmType(): string; /** @ignore */ _combineLLMOutput(): never[]; } export {};