fix: stop telling people the cache key records the mapped tier
It records the asked-for one. CacheMW sits outside the transport in the onion, so at lookup time the nearest-mapping has not happened yet and the applied tier does not exist. Telemetry's success rows do record the mapped tier, which is where the confusion came from — the warning conflated the two and would have sent anyone debugging a cache miss the wrong way. Also repairs the design doc: the 2026-09-05 rollback note had been spliced into the equivalence table, orphaning its last row, and §3.1 still said seven tiers after `auto` made it eight.
This commit is contained in:
@@ -53,7 +53,7 @@ issue #20 的字面诉求是补一条 `zhipu` profile。补上它**不能**解
|
|||||||
|
|
||||||
### 3.1 档位词汇
|
### 3.1 档位词汇
|
||||||
|
|
||||||
七档封闭枚举,取四家参考实现共同收敛的词汇(cherry / OpenRouter / LiteLLM / new-api 用的是同一套):
|
八档封闭枚举,取四家参考实现共同收敛的词汇(cherry / OpenRouter / LiteLLM / new-api 用的是同一套):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
class Effort(StrEnum):
|
class Effort(StrEnum):
|
||||||
@@ -164,12 +164,11 @@ request.reasoning_effort > source.reasoning_effort > source.enable_thinking(语
|
|||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| `on_base` 完整表达「开」(qwen/deepseek/zhipu/moonshot) | `{"enable_thinking": True}` 等 | 同左 | **逐字节等价** |
|
| `on_base` 完整表达「开」(qwen/deepseek/zhipu/moonshot) | `{"enable_thinking": True}` 等 | 同左 | **逐字节等价** |
|
||||||
| 靠档位表达「开」(openai/anthropic/google) | `{"reasoning_effort": "medium"}` | `{}`(不注入) | **行为变更** |
|
| 靠档位表达「开」(openai/anthropic/google) | `{"reasoning_effort": "medium"}` | `{}`(不注入) | **行为变更** |
|
||||||
| 同上但默认不推理(minimax) | `{"reasoning_effort": "medium"}` | 同左(2026-09-05 回退) | **逐字节等价** |
|
| 同上但**默认不推理**(minimax) | `{"reasoning_effort": "medium"}` | 同左(2026-09-05 回退) | **逐字节等价** |
|
||||||
|
|
||||||
第一行是**有意的**: 旧版那个 `medium` 是库替下游做的档位判断(profile 注释自己承认「取 medium 是因为它是五档里语义最接近厂商正常强度的一档」),而 `medium` 在 GLM/kimi/deepseek 的档位表里根本不存在——正是本设计要消灭的东西。语义仍是「开」(这三家的模型经 OpenRouter 登记默认即推理),只是不再强制一个档;要指定强度请显式配 `REASONING_EFFORT`。须进 CHANGELOG 的行为变更条目。
|
第一行是**有意的**: 旧版那个 `medium` 是库替下游做的档位判断(profile 注释自己承认「取 medium 是因为它是五档里语义最接近厂商正常强度的一档」),而 `medium` 在 GLM/kimi/deepseek 的档位表里根本不存在——正是本设计要消灭的东西。语义仍是「开」(这三家的模型经 OpenRouter 登记默认即推理),只是不再强制一个档;要指定强度请显式配 `REASONING_EFFORT`。须进 CHANGELOG 的行为变更条目。
|
||||||
|
|
||||||
**第二行是 2026-09-05 的回退(issue #21,人类拍板的最小修复)**: 上述「语义仍是开」依赖「模型默认就推理」这个前提,T10 真实网关实测证明 MiniMax-M3 不满足它——不发任何推理参数时 5/5 轮不推理。故 `minimax` 段的 `on_base` 改回 `{"reasoning_effort": "medium"}`,存量 `ENABLE_THINKING=true` 的行为逐字恢复。这是权宜之计: 正解是让 `auto` 受能力表约束(模型不支持「由模型自定」时报错并指路显式档位),属公共行为变更,下一版处理。
|
**第三行是 2026-09-05 的回退(issue #21,人类拍板的最小修复)**: 上述「语义仍是开」依赖「模型默认就推理」这个前提,T10 真实网关实测证明 MiniMax-M3 不满足它——不发任何推理参数时 5/5 轮不推理。故 `minimax` 段的 `on_base` 改回 `{"reasoning_effort": "medium"}`,存量 `ENABLE_THINKING=true` 的行为逐字恢复。这是权宜之计: 正解是让 `auto` 受能力表约束(模型不支持「由模型自定」时报错并指路显式档位),属公共行为变更,下一版处理。
|
||||||
| `enable_thinking=None` | 不表态 |
|
|
||||||
|
|
||||||
**同源同时配 `enable_thinking` 与 `reasoning_effort` 且语义矛盾**(如 `True` + `none`)→ **构造期 `ValueError`**。不做「后者赢」的静默兜底: 两个字段表达同一件事时,矛盾是配置错误,不是优先级问题。
|
**同源同时配 `enable_thinking` 与 `reasoning_effort` 且语义矛盾**(如 `True` + `none`)→ **构造期 `ValueError`**。不做「后者赢」的静默兜底: 两个字段表达同一件事时,矛盾是配置错误,不是优先级问题。
|
||||||
|
|
||||||
|
|||||||
@@ -556,7 +556,8 @@ def _settle_tier(
|
|||||||
)
|
)
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"模型 {} 不支持 reasoning_effort={},按 effort_fallback=nearest 改用最近的 {} 档;"
|
"模型 {} 不支持 reasoning_effort={},按 effort_fallback=nearest 改用最近的 {} 档;"
|
||||||
"本次真正发出去的是后者,遥测与缓存 key 记的也是后者",
|
"本次真正发出去的、以及遥测成功行记的都是后者,但**缓存 key 记的是前者**"
|
||||||
|
"(CacheMW 在洋葱里比 transport 更外,查缓存时映射尚未发生,拿不到实发档)",
|
||||||
model,
|
model,
|
||||||
effort.value,
|
effort.value,
|
||||||
mapped.value,
|
mapped.value,
|
||||||
|
|||||||
Reference in New Issue
Block a user