export interface AIProvider { provider: 'openai' | 'anthropic' | 'ollama' | 'lmstudio' | 'groq'; generate(prompt: string, systemPrompt?: string): Promise; validate?(): Promise; } export interface AIProviderConfig { provider: 'openai' | 'anthropic' | 'ollama' | 'lmstudio' | 'groq'; apiKey: string; model?: string; baseUrl?: string; } import { OpenAIProvider } from './openai'; import { AnthropicProvider } from './anthropic'; import { OllamaProvider } from './ollama'; import { LMStudioProvider } from './lmstudio'; import { GroqProvider } from './groq'; export function createAIProvider(config: AIProviderConfig): AIProvider { switch (config.provider) { case 'openai': return new OpenAIProvider(config); case 'anthropic': return new AnthropicProvider(config); case 'ollama': return new OllamaProvider(config); case 'lmstudio': return new LMStudioProvider(config); case 'groq': return new GroqProvider(config); default: throw new Error(`Unknown AI provider: ${config.provider}`); } }