Fix SSE route dependency and align architecture docs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""DeepSeek LLM客户端 - OpenAI兼容API"""
|
||||
"""Provide service-layer logic for deepseek client."""
|
||||
|
||||
import time
|
||||
from typing import List, Dict, Optional
|
||||
@@ -6,20 +6,12 @@ from loguru import logger
|
||||
import httpx
|
||||
|
||||
from .base_client import BaseLLMClient, LLMResponse, LLMConfig, LLMProvider
|
||||
# Keep provider-specific behavior explicit so debugging stays straightforward.
|
||||
|
||||
|
||||
|
||||
class DeepSeekClient(BaseLLMClient):
|
||||
"""
|
||||
DeepSeek API客户端(OpenAI兼容格式)
|
||||
|
||||
支持模型:
|
||||
- deepseek-chat
|
||||
- deepseek-coder
|
||||
- deepseek-reasoner
|
||||
- deepseek-v3
|
||||
- deepseek-v3.2
|
||||
- deepseek-v4-flash
|
||||
"""
|
||||
"""Represent the Deep Seek Client type."""
|
||||
|
||||
SUPPORTED_MODELS = [
|
||||
"deepseek-chat",
|
||||
@@ -31,13 +23,14 @@ class DeepSeekClient(BaseLLMClient):
|
||||
]
|
||||
|
||||
def __init__(self, config: LLMConfig):
|
||||
"""Initialize the Deep Seek Client instance."""
|
||||
if config.provider != LLMProvider.DEEPSEEK:
|
||||
raise ValueError(f"配置provider应为DEEPSEEK,实际为{config.provider}")
|
||||
super().__init__(config)
|
||||
self._init_client()
|
||||
|
||||
def _init_client(self):
|
||||
"""初始化HTTP客户端"""
|
||||
"""Handle init client for this module for the Deep Seek Client instance."""
|
||||
self._client = httpx.Client(
|
||||
base_url=self.config.base_url,
|
||||
headers={
|
||||
@@ -55,7 +48,7 @@ class DeepSeekClient(BaseLLMClient):
|
||||
temperature: Optional[float] = None,
|
||||
**kwargs
|
||||
) -> LLMResponse:
|
||||
"""对话补全"""
|
||||
"""Handle chat for the Deep Seek Client instance."""
|
||||
start_time = time.time()
|
||||
|
||||
try:
|
||||
@@ -103,11 +96,11 @@ class DeepSeekClient(BaseLLMClient):
|
||||
)
|
||||
|
||||
def get_available_models(self) -> List[str]:
|
||||
"""获取可用模型列表"""
|
||||
"""Return available models for the Deep Seek Client instance."""
|
||||
return self.SUPPORTED_MODELS
|
||||
|
||||
def close(self):
|
||||
"""关闭客户端"""
|
||||
"""Release the resources held by this component."""
|
||||
if self._client:
|
||||
self._client.close()
|
||||
|
||||
@@ -118,7 +111,7 @@ def create_deepseek_client(
|
||||
base_url: str = "http://6.86.80.4:30080/v1",
|
||||
**kwargs
|
||||
) -> DeepSeekClient:
|
||||
"""便捷函数:创建DeepSeek客户端"""
|
||||
"""Create deepseek client."""
|
||||
config = LLMConfig(
|
||||
provider=LLMProvider.DEEPSEEK,
|
||||
model=model,
|
||||
|
||||
Reference in New Issue
Block a user