first commit

This commit is contained in:
2026-04-07 16:05:05 +08:00
commit 9d9bdbb1ce
136 changed files with 5103 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
from .factory import LLMFactory
from .base import BaseLLMClient
from .dashscope import DashScopeClient
from .openai import OpenAIClient
from .anthropic import AnthropicClient
__all__ = [
"LLMFactory",
"BaseLLMClient",
"DashScopeClient",
"OpenAIClient",
"AnthropicClient",
]
+9
View File
@@ -0,0 +1,9 @@
from .base import BaseLLMClient
class AnthropicClient(BaseLLMClient):
def chat(self, messages, **kwargs):
pass
def stream_chat(self, messages, **kwargs):
pass
+14
View File
@@ -0,0 +1,14 @@
from abc import ABC, abstractmethod
class BaseLLMClient(ABC):
def __init__(self, config):
self.config = config
@abstractmethod
def chat(self, messages, **kwargs):
pass
@abstractmethod
def stream_chat(self, messages, **kwargs):
pass
+9
View File
@@ -0,0 +1,9 @@
from .base import BaseLLMClient
class DashScopeClient(BaseLLMClient):
def chat(self, messages, **kwargs):
pass
def stream_chat(self, messages, **kwargs):
pass
+22
View File
@@ -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
+9
View File
@@ -0,0 +1,9 @@
from .base import BaseLLMClient
class OpenAIClient(BaseLLMClient):
def chat(self, messages, **kwargs):
pass
def stream_chat(self, messages, **kwargs):
pass