The verifier caught that the disable-direction evidence only proved "no regression", not "actually took effect": on M3 the disabled runs and the no-opinion baseline are identically distributed, because that model does not reason by default anyway. So the disable runs alone cannot rule out the very failure mode issue #5 is about -- the parameter being silently dropped upstream. The bogus-value experiment that does rule it out was sitting in the findings document instead of the test suite; it is now case L3b, and the L3 assertion that could never fail is gone. Also from the review: the e2e helper caught bare Exception, which would have disguised a library bug as an unavailable source, exactly the silence the reporting discipline exists to prevent; the unregistered model warning fired on every request instead of once per source; and the transport caught ValueError broadly enough to mislabel unrelated errors, now narrowed to a dedicated ThinkingUnsupportedError. The design and plan still described the original judgement criteria, which the measurements had already overturned. Both now match what the tests actually do, and the design no longer claims the only new failure surface is the openai one -- dissect configures MiniMax-M2.7 with ENABLE_THINKING=false and will fail at assembly, which has to be coordinated before this merges.
This commit is contained in:
@@ -24,6 +24,7 @@ from polygateway.errors import (
|
||||
from polygateway.providers import (
|
||||
ProviderProfile,
|
||||
ThinkingCapability,
|
||||
ThinkingUnsupportedError,
|
||||
get_capability,
|
||||
get_provider,
|
||||
resolve_thinking,
|
||||
@@ -295,6 +296,9 @@ class OpenAICompatTransport:
|
||||
) -> None:
|
||||
self._registry = registry
|
||||
self._capabilities = capabilities
|
||||
# 未登记模型只喊一次: 装配期已喊过,逐次调用再喊是日志洪水。
|
||||
# 实例级而非模块级 —— 模块级可变状态违反纯 asyncio 中立铁律
|
||||
self._warned_models: set[str] = set()
|
||||
self._client_factory = client_factory or _default_client_factory
|
||||
self._clients: dict[str, httpx.AsyncClient] = {}
|
||||
|
||||
@@ -320,8 +324,16 @@ class OpenAICompatTransport:
|
||||
# 形态(provider 级)与能力(model 级)在此相遇;不可满足时 ValueError,
|
||||
# 由 complete() 翻译为四分类之一(issue #5)
|
||||
capability = get_capability(source.model, table=self._capabilities)
|
||||
first_time = source.model not in self._warned_models
|
||||
self._warned_models.add(source.model)
|
||||
payload.update(
|
||||
resolve_thinking(profile, capability, source.enable_thinking, model=source.model)
|
||||
resolve_thinking(
|
||||
profile,
|
||||
capability,
|
||||
source.enable_thinking,
|
||||
model=source.model,
|
||||
warn_unregistered=first_time,
|
||||
)
|
||||
)
|
||||
# 顺序即优先级(issue #4 设计决策 A): 配置级 extra_body 在前,调用级
|
||||
# overlay(含结构化注入)在后覆盖之。两行不可调换
|
||||
@@ -344,8 +356,9 @@ class OpenAICompatTransport:
|
||||
payload = self._build_payload(
|
||||
messages=messages, source=source, profile=profile, stream=stream, overlay=overlay
|
||||
)
|
||||
except ValueError as exc:
|
||||
# 推理开关不可满足是**请求本身**的问题: 换源重试都救不了它
|
||||
except ThinkingUnsupportedError as exc:
|
||||
# 推理开关不可满足是**请求本身**的问题: 换源重试都救不了它。只捕这个
|
||||
# 专用类型而非宽 catch ValueError —— 后者会把序列化等无关错误误贴标签
|
||||
raise RequestRejectedError(
|
||||
f"{source.name} 推理开关无法满足: {exc}",
|
||||
source_name=source.name,
|
||||
|
||||
Reference in New Issue
Block a user