"""
LLM模块
提供统一的LLM接口和DashScope、Ollama、OpenAI兼容集成。
"""

from .dashscope_client import (
    DashScopeClient,
    DashScopeStreamClient,
    create_dashscope_client,
    create_dashscope_stream_client,
)
from .llm_interface import (
    ChatMessage,
    LLMFactory,
    LLMInterface,
    LLMResponse,
    MessageRole,
)


try:
    from .ollama_client import (
        OllamaClient,
        OllamaStreamClient,
        create_ollama_client,
        create_ollama_stream_client,
    )

    _OLLAMA_AVAILABLE = True
except ImportError:
    _OLLAMA_AVAILABLE = False

try:
    from .openai_client import (
        OpenAICompatibleClient,
        create_openai_client,
    )

    _OPENAI_AVAILABLE = True
except ImportError:
    _OPENAI_AVAILABLE = False


__all__ = [
    "ChatMessage",
    "DashScopeClient",
    "DashScopeStreamClient",
    "LLMFactory",
    "LLMInterface",
    "LLMResponse",
    "MessageRole",
    "create_dashscope_client",
    "create_dashscope_stream_client",
]

if _OLLAMA_AVAILABLE:
    __all__.extend(
        [
            "OllamaClient",
            "OllamaStreamClient",
            "create_ollama_client",
            "create_ollama_stream_client",
        ]
    )

if _OPENAI_AVAILABLE:
    __all__.extend(
        [
            "OpenAICompatibleClient",
            "create_openai_client",
        ]
    )
