mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 15:37:55 +08:00
lmproto: add DeepSeek Anthropic client
This commit is contained in:
@@ -3,10 +3,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from plyngent.lmproto.anthropic.client import AnthropicClient
|
||||
from plyngent.lmproto.deepseek import DeepseekOpenAIClient, DeepseekResponsesClient
|
||||
from plyngent.lmproto.deepseek import (
|
||||
DeepseekAnthropicClient,
|
||||
DeepseekOpenAIClient,
|
||||
DeepseekResponsesClient,
|
||||
)
|
||||
from plyngent.lmproto.openai.client import OpenAIClient
|
||||
from plyngent.lmproto.openai_compatible.client import OpenAICompatibleClient
|
||||
|
||||
type AnyLLMClient = (
|
||||
OpenAICompatibleClient | DeepseekOpenAIClient | DeepseekResponsesClient | OpenAIClient | AnthropicClient
|
||||
OpenAICompatibleClient
|
||||
| DeepseekOpenAIClient
|
||||
| DeepseekResponsesClient
|
||||
| DeepseekAnthropicClient
|
||||
| OpenAIClient
|
||||
| AnthropicClient
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from .anthropic.client import DeepseekAnthropicClient as DeepseekAnthropicClient
|
||||
from .openai_compat.client import DeepseekOpenAIClient as DeepseekOpenAIClient
|
||||
from .openai_compat.model import AnyChatMessage as AnyChatMessage
|
||||
from .openai_compat.model import AssistantChatMessage as AssistantChatMessage
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from .client import DeepseekAnthropicClient as DeepseekAnthropicClient
|
||||
@@ -0,0 +1,35 @@
|
||||
"""DeepSeek Anthropic Messages client (``POST /messages`` on the DeepSeek endpoint)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, override
|
||||
|
||||
from plyngent.lmproto.anthropic.client import AnthropicClient
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from plyngent.lmproto.anthropic.config import AnthropicConfig
|
||||
|
||||
|
||||
class DeepseekAnthropicClient(AnthropicClient):
|
||||
"""Anthropic Messages client pointed at DeepSeek's Anthropic-compatible endpoint.
|
||||
|
||||
DeepSeek exposes the Anthropic API format at ``https://api.deepseek.com/anthropic``
|
||||
(see https://api-docs.deepseek.com/guides/anthropic_api). ``x-api-key`` is fully
|
||||
supported; ``anthropic-version`` / ``anthropic-beta`` headers are ignored by the
|
||||
server but harmless. Model ids map server-side: ``claude-opus*`` → ``deepseek-v4-pro``,
|
||||
``claude-haiku*`` / ``claude-sonnet*`` → ``deepseek-v4-flash``, unknown names →
|
||||
``deepseek-v4-flash``; real DeepSeek ids pass through as-is.
|
||||
|
||||
``GET /models`` is not documented on the ``/anthropic`` base, so ``models()``
|
||||
returns an empty list and model selection stays config-driven.
|
||||
"""
|
||||
|
||||
kind: str = "messages"
|
||||
|
||||
def __init__(self, config: AnthropicConfig) -> None:
|
||||
super().__init__(config)
|
||||
|
||||
@override
|
||||
async def models(self) -> list[str]:
|
||||
"""No documented ``GET /models`` on DeepSeek's ``/anthropic`` base."""
|
||||
return []
|
||||
Reference in New Issue
Block a user