"""
LLM Factory - LLM 工厂类
"""
from typing import Optional
from app.agent.llm.openai import OpenAILLM
from app.agent.llm.anthropic import AnthropicLLM


class LLMFactory:
    """LLM 工厂类"""

    @staticmethod
    def create(provider: str, model_name: str, api_key: Optional[str] = None, base_url: Optional[str] = None):
        """
        创建 LLM 实例

        Args:
            provider: 模型提供商 (openai/anthropic)
            model_name: 模型名称
            api_key: API Key（可选）
            base_url: Base URL（可选）

        Returns:
            LLM 实例
        """
        if provider.lower() == "openai":
            return OpenAILLM(model_name, api_key, base_url)
        elif provider.lower() == "anthropic":
            return AnthropicLLM(model_name, api_key, base_url)
        else:
            # 默认使用 OpenAI
            return OpenAILLM(model_name, api_key, base_url)
