import { UISchema } from '../types'; /** * Supported LLM providers */ export type LLMProvider = 'openai' | 'anthropic' | 'custom'; /** * LLM Configuration interface * Supports OpenAI, Anthropic, and custom providers */ export interface LLMConfig { /** LLM provider type */ provider: LLMProvider; /** API key for authentication */ apiKey: string; /** Model identifier (e.g., 'gpt-4', 'claude-3-opus') */ model: string; /** API endpoint URL (required for custom provider) */ endpoint?: string; /** Maximum tokens in response */ maxTokens?: number; /** Temperature for response randomness (0-1) */ temperature?: number; /** System prompt to prepend to conversations */ systemPrompt?: string; /** Request timeout in milliseconds */ timeout?: number; /** Custom headers for API requests */ headers?: Record; } /** * Default configurations for each provider */ export declare const DEFAULT_CONFIGS: Record>; /** * Validates LLM configuration */ export declare function validateLLMConfig(config: LLMConfig): { valid: boolean; errors: string[]; }; /** * Creates a complete LLM configuration by merging with defaults */ export declare function createLLMConfig(config: LLMConfig): LLMConfig; /** * Chat message structure */ export interface ChatMessage { /** Message role */ role: 'system' | 'user' | 'assistant'; /** Message content */ content: string; } /** * Streaming chunk from LLM response */ export interface StreamChunk { /** Content delta */ content: string; /** Whether this is the final chunk */ done: boolean; /** Error if any */ error?: string; } /** * Sends a message to the LLM and returns an async iterator for streaming response * * @param messages - Array of chat messages * @param config - LLM configuration * @yields StreamChunk - Streaming chunks of the response */ export declare function sendMessage(messages: ChatMessage[], config: LLMConfig): AsyncGenerator; /** * Result of JSON extraction from LLM response */ export interface JSONExtractionResult { /** Whether extraction was successful */ success: boolean; /** Extracted JSON string (if successful) */ json?: string; /** Parsed JSON object (if successful) */ parsed?: unknown; /** Error message (if failed) */ error?: string; } /** * Extracts JSON code blocks from text * Supports ```json ... ``` and ``` ... ``` formats * * @param text - Text containing JSON code blocks * @returns Array of extracted JSON strings */ export declare function extractJSONBlocks(text: string): string[]; /** * Extracts and parses JSON from LLM response text * * @param text - LLM response text * @returns JSONExtractionResult */ export declare function extractJSON(text: string): JSONExtractionResult; /** * Extracts UISchema from LLM response text * * @param text - LLM response text * @returns UISchema if found and valid, null otherwise */ export declare function extractUISchema(text: string): UISchema | null; /** * Collects all streaming chunks into a complete response * * @param stream - Async generator of stream chunks * @returns Complete response text */ export declare function collectStreamResponse(stream: AsyncGenerator): Promise<{ content: string; error?: string; }>; //# sourceMappingURL=llm-service.d.ts.map