fix(openai-client): 按子变体细分 reasoning 家族的 temperature 剥离#1
Open
canarybyte wants to merge 1 commit into
Open
Conversation
之前 _sanitize_body 用单一 prefix ("gpt-5.5",) 判定,导致两类问题:
1. 漏剥:gpt-5.4 / gpt-5.4-pro 是 reasoning 模型,也拒绝 temperature,
用户测这些模型直连 api.openai.com 时拿 HTTP 400 全 0 分
(实测样本 web_data/jobs/openai/uXQaEDP-.json,Apr 2026)
2. 一旦扩成宽 prefix 又会误剥:gpt-5.4-mini / gpt-5.4-nano 是
非 reasoning 子变体,实际接受 temperature(mem0#4738);
gpt-5.1 系列在 reasoning_effort=none 时也接受(litellm#27351)
改法:把元组重构成"家族 prefix + 子变体例外"两层匹配,新增
_rejects_temperature() helper,沿用现有点-横杠归一化保持一致。
覆盖测试 14 个边界(参数化),包括子变体 -mini/-nano 反向豁免、
dated snapshot (gpt-5.5-2026-04-23) 命中、写法变体归一化。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
零分排行榜里观察到一类规律性失败:用户用
gpt-5.5/gpt-5.5-2026-04-23直连api.openai.com,所有 detector 拿 HTTP 400:(实测样本:
web_data/jobs/openai/uXQaEDP-.json、tkduF5Fj.json,2026-05-04)根因
_sanitize_body用单一 prefix("gpt-5.5",)判定要不要剥temperature。这个清单漏了 GPT-5.4 系列——5.4 / 5.4-pro 同样是 reasoning 模型,也拒绝 temperature。但简单扩成宽 prefix 又会误剥子变体:
gpt-5.4-mini/gpt-5.4-nano是非 reasoning 子模型,实际接受 temperature(参考 mem0#4738);gpt-5.1*在 `reasoning_effort=none` 时也接受(litellm#27351)。如果剥了它们,detector 就失去确定性输出,consistency / model_consistency 这些会被坏掉。改动
把元组替换成"家族 prefix + 子变体例外"两层匹配:
测试覆盖
参数化新增 14 个用例(`tests/test_openai_phase2.py`):
完整 256/256 通过。
部署状态
来源