# services/llm/llm_factory.py """ Factory class for creating LLM services """ from typing import Optional from .openai_service import OpenAIService from .ollama_service import OllamaService from .groq_service import GroqService from .claude_service import ClaudeService from .grok_service import GrokService from .gemini_service import GeminiService from .base import LLMService class LLMFactory: """Factory class for creating LLM service instances""" @staticmethod def create_service(service_type: str, **kwargs) -> Optional[LLMService]: """ Create an instance of the specified LLM service Args: service_type: Type of LLM service ("openai", "ollama", "groq", "claude", "grok") **kwargs: Additional arguments for service initialization """ services = { "openai": OpenAIService, "ollama": OllamaService, "groq": GroqService, "claude": ClaudeService, "grok": GrokService, "gemini": GeminiService, } service_class = services.get(service_type.lower()) if service_class: return service_class(**kwargs) else: print(f"Unknown service type: {service_type}") return None