/** * LLM client interface for abstracting different providers. */ export interface Message { role: 'system' | 'user' | 'assistant'; content: string; } export interface CompletionOptions { /** Model to use */ model?: string; /** Maximum tokens in response */ maxTokens?: number; /** Temperature for sampling (0-2) */ temperature?: number; /** Response format */ responseFormat?: 'text' | 'json'; /** System prompt to set context */ systemPrompt?: string; /** Optional abort signal to cancel the request */ signal?: AbortSignal; } /** * Options for streaming completions. */ export interface StreamingOptions extends CompletionOptions { /** Callback invoked with each chunk of text as it arrives */ onChunk?: (chunk: string) => void; /** Callback invoked when streaming completes with full text */ onComplete?: (fullText: string) => void; /** Callback invoked if an error occurs during streaming */ onError?: (error: Error) => void; } /** * Result of a streaming completion. */ export interface StreamingResult { /** The complete text (after streaming finishes) */ text: string; /** Whether streaming completed successfully */ completed: boolean; } /** * Provider capabilities and metadata. */ export interface ProviderInfo { /** Unique provider identifier */ id: string; /** Human-readable provider name */ name: string; /** Whether the provider supports JSON mode */ supportsJSON: boolean; /** Whether the provider supports streaming */ supportsStreaming: boolean; /** Default model for this provider */ defaultModel: string; } export interface LLMClient { /** * Get provider information. */ getProviderInfo(): ProviderInfo; /** * Generate a completion from a list of messages. */ chat(messages: Message[], options?: CompletionOptions): Promise; /** * Generate a completion from a single prompt. */ complete(prompt: string, options?: CompletionOptions): Promise; /** * Stream a completion from a single prompt. * Yields text chunks as they arrive from the LLM. * Returns the complete response text when done. */ stream(prompt: string, options?: StreamingOptions): Promise; /** * Stream a chat completion from a list of messages. * Yields text chunks as they arrive from the LLM. * Returns the complete response text when done. */ streamChat(messages: Message[], options?: StreamingOptions): Promise; /** * Parse JSON from LLM response, handling common formatting issues. */ parseJSON(response: string): T; } /** * Default model configurations per provider. * Uses budget-friendly models by default for cost efficiency. * @see constants.ts for the source values */ export declare const DEFAULT_MODELS: Record; /** * Premium model configurations for --quality flag. * Higher quality output but more expensive. * @see constants.ts for the source values */ export declare const PREMIUM_MODELS: Record; /** * Provider IDs. */ export type LLMProviderId = 'openai' | 'anthropic' | 'ollama'; /** * Configuration for LLM providers. */ export interface LLMConfig { /** Provider to use */ provider: LLMProviderId; /** Model to use (provider-specific) */ model?: string; /** API key (or env var name containing it) */ apiKey?: string; /** Environment variable containing API key */ apiKeyEnvVar?: string; /** Base URL for API (for proxies/self-hosted) */ baseUrl?: string; /** Callback to receive actual token usage from each API call */ onUsage?: (inputTokens: number, outputTokens: number) => void; } /** * Parse JSON from LLM response, handling common formatting issues. * Shared utility function for all providers. */ export declare function parseJSONResponse(response: string): T; //# sourceMappingURL=client.d.ts.map