Files
sentclaw/backend/app/llm/factory.py
T
2026-04-07 16:05:05 +08:00

23 lines
631 B
Python

from .dashscope import DashScopeClient
from .openai import OpenAIClient
from .anthropic import AnthropicClient
class LLMFactory:
_clients = {
"dashscope": DashScopeClient,
"openai": OpenAIClient,
"anthropic": AnthropicClient,
}
@classmethod
def create_client(cls, provider, config):
client_class = cls._clients.get(provider)
if not client_class:
raise ValueError(f"不支持的 LLM 提供商: {provider}")
return client_class(config)
@classmethod
def register_client(cls, provider, client_class):
cls._clients[provider] = client_class