/** * LLM Client - Unified interface for all LLM providers using AI SDK * * Replaces direct Anthropic/OpenAI SDK usage with Vercel AI SDK's * provider-agnostic interface. Single source of truth for all LLM calls. */ import { generateText } from "ai"; import type { AnthropicProviderOptions } from "@ai-sdk/anthropic"; import type { OpenAIChatLanguageModelOptions, OpenAIResponsesProviderOptions } from "@ai-sdk/openai"; import type { GroqProviderOptions } from "@ai-sdk/groq"; import type { GoogleGenerativeAIProviderOptions } from "@ai-sdk/google"; import { type AllSupportedModels } from "./provider-and-models"; /** * Strongly-typed provider-specific options using AI SDK exported types */ export type ProviderOptions = { anthropic?: AnthropicProviderOptions; openai?: OpenAIChatLanguageModelOptions & OpenAIResponsesProviderOptions; groq?: GroqProviderOptions; google?: GoogleGenerativeAIProviderOptions; }; /** * Get provider-specific options for a given model with optional defaults * * @param model - The model name to get provider options for * @returns Provider options narrowed to the specific provider for the model * * @example * const options = getProviderOptionsForModel('claude-3-5-sonnet-20241022'); * // Returns: { anthropic?: AnthropicProviderOptions } */ export declare function getProviderOptionsForModel(model: AllSupportedModels): ProviderOptions; export interface LLMOptions { /** Model name (can be alias or full ID) */ model?: AllSupportedModels; /** Maximum tokens to generate */ maxTokens?: number; /** Temperature (0-1) for response randomness */ temperature?: number; /** Tools available for the LLM to use */ tools?: Parameters[number]["tools"]; /** Tool choice strategy */ toolChoice?: Parameters[number]["toolChoice"]; /** Condition for stopping generation with tool results (default: stepCountIs(1)) */ stopWhen?: Parameters[number]["stopWhen"]; /** Provider-specific options (anthropic, openai, groq, etc.) */ providerOptions?: ProviderOptions; /** Maximum duration in milliseconds for the generation request */ maxDuration?: number; } export interface LLMContext { /** The prompt/context to send to the LLM */ prompt: string; /** Optional system message */ system?: string; } export declare class LLMClient { private readonly hasAnthropicKey; private readonly hasOpenAIKey; private readonly hasVercelKey; private readonly hasGroqKey; private readonly hasGoogleKey; private readonly googleProvider; private stepCounter; constructor(); /** * Enhanced onStepFinish callback that provides readable, formatted output * for LLM generation steps including tool calls, token usage, and status. */ private readonly onStepFinish; /** * Generate text using AI SDK's unified interface */ generate(context: LLMContext, options?: LLMOptions): Promise<{ text: string; finishReason: string; }>; /** * Validate that the provider has an API key */ private validateProvider; /** * Get the AI SDK model instance for a provider and model name */ private getModel; } //# sourceMappingURL=llm-client.d.ts.map