- [Adaptive Thinking Budget Negotiation & User-Intent Recognition Machine] Eliminate Google 400 Invariant Violations, 6x Ratio Fast-Response Compression & Smart Budget Expansion (PR #3599):
- Bypass Elimination & Ingress Invariant Ingress: Removed legacy early
return Some(budget)exits inInboundThinkingPipeline, ensuring all client and gateway mode requests uniformly traverse authoritativesafe_limitchecks from official model catalogs. - 6x Ratio Fast & Concise Intent Recognition: When a client explicitly specifies
mandt >= 6 * m(e.g.m = 1024, t = 8192), gateway intelligently detects the intent for an instant, concise reply without lengthy deliberation, compressing thinking budget tom - 1024(t = 0whenm <= 1024for instant output). - Smart Budget Expansion for Deep Reasoning (Preserve Model IQ): When official physical capacity allows (
t + 1024 <= max), gateway refuses to truncate user reasoning, automatically expandingm = t + 1024to preserve 100% of the thinking budget within official limits. - Physical Ceiling Clamping Fallback: Only when thinking budget genuinely breaches the model's physical limit (
t + 1024 > max),mis anchored tomaxwith thinking budget clamped tomax - 1024(leaving 1024 tokens for completion), strictly satisfyingm > tand eliminating Google400 INVALID_ARGUMENT. - Gemini Adapter Wrapper Invariant & Test Suite: Mirrored invariant enforcement in
gemini/wrapper.rsand added full test suites inofficial_alignment_tests.rs. (Thanks to @cubelikeplayDaniel)
- Bypass Elimination & Ingress Invariant Ingress: Removed legacy early
- [自适应思考预算协商状态机与意图识别架构] 彻底杜绝 maxOutputTokens <= thinkingBudget 引发 Google 400,科学识别 6 倍反差极速意图并智能扩充总预算保全推理智商 (PR #3599):
- 废除提前 return 旁路与全链路贯穿终审校验: 彻底移除
InboundThinkingPipeline中 Client 模式与 Gateway 模式的过早return Some(budget)旁路,统一贯穿官方模型目录权威safe_limit物理硬顶终审校验。 - 6 倍反差极速意图识别 (Fast & Concise Intent): 针对客户端传了明确总输出
m的场景,当思考预算t >= 6 * m时(例如用户传m = 1024, t = 8192),精准识别用户强烈希望一句话简明直接回答、不希望被漫长思考拖慢的诉求,自动压缩思考预算至m - 1024(当m <= 1024时自动归零关闭思考,实现模型秒回吐字)。 - 常规深度推理智能自动扩充 (保全思考智商): 未触发极速意图时,若客户端传入的
m较小但官方物理容量能容纳思考预算(t + 1024 <= max),网关坚决不阉割用户的思考能力,自动提升总输出预算至m = t + 1024(且不超过官方上限),100% 完整保留用户的深度思考推导能力! - 物理天花板硬顶终审兜底: 仅当思考预算极大超限突破官方物理天花板时(
t + 1024 > max),终审兜底将总预算锚定官方上限max,思考预算收敛至max - 1024(留出 1024 正文空间),从数学与协议层 100% 杜绝 GoogleHTTP 400 INVALID_ARGUMENT报错。 - Gemini Adapter Wrapper 终审兜底与单测覆盖: 在
gemini/wrapper.rs增加同等协商保护,在official_alignment_tests.rs补充 6 倍反差压缩、自动扩充与物理兜底全套单测。 (Thanks to @cubelikeplayDaniel)
- 废除提前 return 旁路与全链路贯穿终审校验: 彻底移除
What's Changed
- fix(proxy): 修复思考预算超限截断导致的协议硬约束违背 (maxOutputTokens > thinkingBudget) by @cubelikeplayDaniel in #3599
Full Changelog: v4.9.3...v4.9.4