Skip to content

fix(relaykit): match Gemini 4 thinking levels by family prefix - #8412

Merged
seefs001 merged 2 commits into
QuantumNous:mainfrom
seefs001:fix/gemini-4-thinking-prefix
Nov 20, 2026
Merged

seefs001 merged 2 commits into
QuantumNous:mainfrom
seefs001:fix/gemini-4-thinking-prefix

Conversation

@seefs001

@seefs001 seefs001 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 关联任务

Closes #8409。与 #8410 不同,本 PR 按家族识别模型,并将输出限制在 Google 公开的档位内。

🚀 变更类型

  • 🐛 Bug 修复

📝 变更描述

跨协议请求转换到 Gemini 时,用 gemini-4- 前缀识别采用 thinkingLevel 的模型。Google 的模型表只为 Neon、Hydrogen 列出了 xhigh;Argon、Carbon 的最高档是 high。

客户端 effort Neon、Hydrogen 其他匹配的 Gemini 4(含 Argon、Carbon)
minimal low low
low、medium、high 原样 原样
xhigh、max xhigh high

minimal → low 遵循 Google 的 OpenAI 兼容映射。generateContent 枚举没有 MAX;将客户端的 max 转为模型最高档是 new-api 的兼容策略,不要求上游接受未公开的值。实际调整档位时会记录 gemini_level_adjusted。

📸 运行证明

  • 修复前: 在 48f9df9 上,bug(relaykit): gemini-4-neon drops thinkingLevel on cross-protocol requests #8409 的 Neon Responses 请求没有生成 thinkingLevel。第一版前缀修复(64faa8d)向 Carbon 发送了 xhigh,并向四款模型发送了 max。
  • 修复后: 本地用 Responses 请求逐一验证四款模型的六档输入,结果与上表一致。Neon 的 Chat reasoning_effort: xhigh 和 Claude Messages output_config.effort: max 均生成 thinkingLevel: xhigh。未调用真实上游。
  • 在 relaykit/ 运行 GOWORK=off go build ./... 和 GOWORK=off go test -count=1 ./...,均通过。回归用例覆盖 Neon 的 max、Carbon 的 xhigh 和既有 Argon、Hydrogen 行为的变化。

✅ 提交前检查项

  • 已核对关联 issue、现有 PR、官方文档和本地转换结果。
  • 改动限于模型能力与档位映射及对应测试,不改渠道配置或透传行为。
  • 维护者人工复核。

Summary by CodeRabbit

  • New Features
    • Thinking-level controls are available across the Gemini 4 model family.
  • Improvements
    • Effort levels are adjusted to match each model: minimal maps to low, while extra-high and maximum map to high or extra-high depending on the model.
    • Adjusted effort levels are reported with a diagnostic.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Gemini reasoning conversion now recognizes every gemini-4- model as supporting thinking levels. It maps requested effort levels according to the model, and the tests verify the resulting levels and adjustment diagnostics.

Changes

Gemini 4 thinking-level conversion

Layer / File(s) Summary
Gemini 4 capability and effort mapping
relaykit/relayconvert/reasoning/gemini.go, relaykit/relayconvert/reasoning/gemini_test.go
The capability check now matches all gemini-4- model prefixes. The mapping adjusts minimal to low; it maps xhigh and max to xhigh for Neon and Hydrogen, and to high for other Gemini 4 models. Tests verify these adjustments and their gemini_level_adjusted diagnostics.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

  • QuantumNous/new-api#8410: Adds an explicit gemini-4-neon entry for the thinking-level conversion addressed by this family-prefix change.

Suggested reviewers: calcium-ion

Merge Risk: Low · up to 75551

Requests for max effort on Gemini 4 Neon are sent as xhigh, though the linked issue and PR description say max should pass through. The impact is limited to that effort level. Either restore max passthrough or document the cap as an intended change before merging.

Pre-merge checks: Passed 2

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(relaykit): match Gemini 4 thinking levels by family prefix" describes the main change. The raw summary shows that geminiCapabilitiesFor now matches every gemini-4- model by prefix inste…
Full details: Title check

Explanation

The title "fix(relaykit): match Gemini 4 thinking levels by family prefix" describes the main change. The raw summary shows that geminiCapabilitiesFor now matches every gemini-4- model by prefix instead of the Argon and Hydrogen prefixes. The title also names the relaykit area and the Gemini 4 thinking-level scope. The title does not mention the effort-level mapping changes (for example, max and xhigh adjustments), but it covers the primary change, so it passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the levels in a row,
gemini-4- now helps them flow.
Minimal settles softly into low,
Neon and Hydrogen reach xhigh’s glow.
Argon and Carbon take high in stride,
The tests record each change applied. <fixed_issue_severity>Medium</fixed_issue_severity>

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0389f2f8-f3fe-48cc-bbb9-5a1ffb168279
Commits

Reviewing files that changed from the base of the PR and between 48f9df9 and 64faa8d.

Files selected for processing: 1

  • relaykit/relayconvert/reasoning/gemini.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@seefs001
seefs001 merged commit a85f7e8 into QuantumNous:main Nov 20, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(relaykit): gemini-4-neon drops thinkingLevel on cross-protocol requests

1 participant