/** * @file Anthropic Claude LLM Provider * @description 实现 Anthropic Messages API,支持 Claude 系列模型, * 内部自动完成 OpenAI 格式 ↔ Anthropic 格式的双向转换 */ import type { LLMProvider, ModelConfig, ModelInfo, ChatParams, ChatResponse, ChatChunk } from './types.js'; export declare class AnthropicProvider implements LLMProvider { private config; constructor(config: ModelConfig); getModel(): ModelInfo; ping(): Promise; chat(params: ChatParams): Promise; chatStream(params: ChatParams): AsyncGenerator; /** 更新配置 */ updateConfig(updates: Partial): void; /** * 将 OpenAI 格式消息转换为 Anthropic 格式 * - system 消息提取为单独的 system 字段 * - tool 消息转换为 user 消息中的 tool_result 块 * - assistant 的 tool_calls 转换为 tool_use 块 */ private convertMessages; /** * 将 ContentPart[] 转换为 Anthropic content blocks * - TextPart → {type: 'text', text} * - ImagePart → {type: 'image', source: {type: 'base64'|'url', ...}} * - FilePart → {type: 'text', text: '[file]\n${content}'} */ private convertContentPartsForAnthropic; private convertTools; private buildRequestBody; /** * 将 responseFormat 约束转为 system prompt 注入文本(Anthropic 无原生 response_format 的降级方案)。 * 两种模式均注入 JSON Schema 约束,要求模型只输出 JSON,不做 strict 强制。 */ private buildStructuredOutputPrompt; private parseResponse; private doRequest; } //# sourceMappingURL=anthropic-provider.d.ts.map