refactor(gateway): 适配器暴露 probe_connection 公开探测——provider_deps 弃私有 _client 反手(CR-M1.4)
This commit is contained in:
@@ -103,6 +103,14 @@ class OpenAICompatAdapter:
|
||||
def capabilities(self) -> Capabilities:
|
||||
return Capabilities(structured_output=True, prefix_cache=True, thinking=False)
|
||||
|
||||
async def probe_connection(self) -> None:
|
||||
"""最小连通性探测:列模型即验 Key 有效(不消耗生成额度),失败原样上抛(CR-M1.4)。
|
||||
|
||||
凭据连接测试的**公开入口**——调用方(apps/api provider_deps)经此验 Key,无需
|
||||
反手适配器私有客户端。任一异常上抛,由调用方映射为 LLM 不可用。
|
||||
"""
|
||||
await self._client.models.list()
|
||||
|
||||
def _structured(self) -> StructuredClient:
|
||||
if self._structured_client is None:
|
||||
# 懒构建:从同一 AsyncOpenAI client patch 出 instructor 客户端。
|
||||
|
||||
Reference in New Issue
Block a user