core/lmproto: add kind property to all clients + AnyLLMClient type

This commit is contained in:
2026-07-29 00:34:42 +08:00
parent 49e878fe3a
commit 6eaadd6ebf
4 changed files with 16 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
"""Agent-level type aliases for LLM client dispatch."""
from __future__ import annotations
from plyngent.lmproto.anthropic.client import AnthropicClient
from plyngent.lmproto.deepseek.openai_compat.client import DeepseekOpenAIClient
from plyngent.lmproto.openai.client import OpenAIClient
from plyngent.lmproto.openai_compatible.client import OpenAICompatibleClient
type AnyLLMClient = OpenAICompatibleClient | DeepseekOpenAIClient | OpenAIClient | AnthropicClient
@@ -30,6 +30,8 @@ def _inject_thinking(data: bytes) -> bytes:
class DeepseekOpenAIClient(BaseOpenAIClient):
kind: str = "chat_completions"
def __init__(self, config: OpenAIConfig) -> None:
super().__init__(config)
+2
View File
@@ -23,6 +23,8 @@ if TYPE_CHECKING:
class OpenAIClient(BaseOpenAIClient):
"""Full OpenAI HTTP client (``/chat/completions`` + ``/responses`` + ``/models``)."""
kind: str = "responses"
response_decoder: msgspec.json.Decoder[Response]
response_deleted_decoder: msgspec.json.Decoder[ResponseDeleted]
response_event_decoder: msgspec.json.Decoder[ResponseStreamEvent]
@@ -180,6 +180,8 @@ class BaseOpenAIClient:
class OpenAICompatibleClient(BaseOpenAIClient):
"""Chat Completions only (``POST /chat/completions`` + ``GET /models``)."""
kind: str = "chat_completions"
def __init__(self, config: OpenAIConfig) -> None:
super().__init__(config)