# 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 .grok_service import GrokService 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", "grok") **kwargs: Additional arguments for service initialization """ services = { "openai": OpenAIService, "ollama": OllamaService, "grok": GrokService } service_class = services.get(service_type.lower()) if service_class: return service_class(**kwargs) else: print(f"Unknown service type: {service_type}") return None