/** * Anthropic (Claude) provider implementation * * HTTP Agent Pooling Status: ✅ IMPLEMENTED * Implementation: Custom fetch using undici with built-in connection pooling * Benefits: Connection reuse, reduced latency, improved performance * Note: undici (Node.js's fetch implementation) has built-in connection pooling enabled by default * * Self-registers with the LLM Provider Registry using dependency inversion pattern */ import type { BatchableProvider } from '../../batch/batch-provider.interface.js'; import type { BatchRequest, BatchResult, BatchStatusInfo, BatchSubmission } from '../../batch/batch.types.js'; import Anthropic from '@anthropic-ai/sdk'; import type { LLMCompletionOptions, LLMCompletionResult } from '../../types/llm.types.js'; import { BaseLLMProvider } from '../provider.interface.js'; export declare class AnthropicProvider extends BaseLLMProvider implements BatchableProvider { name: import("../../config/providers.config.js").ProviderName; private client; private static readonly STREAMING_THRESHOLD; complete(options: LLMCompletionOptions): Promise; /** * Complete using streaming (required for large token requests) */ getAlternativeModels(currentModel?: string): string[]; isConfigured(): boolean; private completeWithStreaming; /** * Get a hashed identifier for rate limiting * Override to support both Vertex AI (project ID) and standard API (API key) modes */ streamComplete(options: LLMCompletionOptions, onChunk: (chunk: string) => void): Promise; /** * Build streaming parameters */ private buildStreamParams; /** * Process streaming response */ validateModel(modelName: string): Promise; protected getRateLimitKey(): string; private getClient; /** * Create a custom fetch function with undici connection pooling */ private createCustomFetch; /** * Create Vertex AI client */ private createVertexClient; /** * Create standard Anthropic client */ private createStandardClient; private processStream; /** * Resolve the actual Anthropic model name based on model and mode */ private extractContent; /** * Extract tool calls from an Anthropic response */ private extractToolCalls; private formatMessages; /** * Format a single message for the Anthropic API */ private formatSingleMessage; /** * Format a tool result message for Anthropic API */ private formatToolResultMessage; /** * Format an assistant message with tool calls for Anthropic API */ private formatAssistantWithToolCalls; /** * Extract usage metrics from Anthropic response, including cache fields */ private extractUsage; /** * Apply cache breakpoints to message params when prompt_caching is enabled. * Uses up to 3 breakpoints: system (1) + tools (1) + last user message (1). */ applyCacheBreakpoints(params: Anthropic.MessageCreateParamsNonStreaming | Anthropic.MessageCreateParamsStreaming): void; /** * Convert system prompt to TextBlockParam[] with cache_control if above token threshold. */ private applyCacheToSystem; /** * Add cache_control to the last tool definition. */ private applyCacheToTools; /** * Add cache_control to the last user message before the final turn. */ private applyCacheToLastUserMessage; private resolveModelName; /** * Resolve the `temperature` to send, or `undefined` to omit it entirely. * Effort-controlled models (see EFFORT_CONTROLLED_MODELS) reject `temperature` * as deprecated; extended thinking requires it fixed at 1. */ private resolveTemperature; cancelBatch(batchId: string): Promise; getBatchResults(batchId: string): Promise; getBatchStatus(batchId: string): Promise; submitBatch(requests: BatchRequest[]): Promise; supportsBatch(): true; } //# sourceMappingURL=anthropic.provider.d.ts.map