first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user