jorel
Version:
The easiest way to use LLMs, including streams, images, documents, tools and various agent scenarios.
23 lines (22 loc) • 1.17 kB
TypeScript
import Anthropic from "@anthropic-ai/sdk";
import { AnthropicBedrock } from "@anthropic-ai/bedrock-sdk";
import { LlmCoreProvider, LlmGenerationConfig, LlmMessage, LlmResponse, LlmStreamResponse, LlmStreamResponseChunk, LlmStreamResponseWithToolCalls } from "../../providers";
export interface AnthropicConfig {
apiKey?: string;
bedrock?: {
awsRegion?: string;
awsAccessKey?: string;
awsSecretKey?: string;
};
name?: string;
}
/** Provides access to OpenAI and other compatible services */
export declare class AnthropicProvider implements LlmCoreProvider {
readonly name: string;
readonly client: AnthropicBedrock | Anthropic;
constructor({ apiKey, bedrock, name }?: AnthropicConfig);
generateResponse(model: string, messages: LlmMessage[], config?: LlmGenerationConfig): Promise<LlmResponse>;
generateResponseStream(model: string, messages: LlmMessage[], config?: LlmGenerationConfig): AsyncGenerator<LlmStreamResponseChunk | LlmStreamResponse | LlmStreamResponseWithToolCalls, void, unknown>;
getAvailableModels(): Promise<string[]>;
createEmbedding(model: string, text: string): Promise<number[]>;
}