Skip to content

fix: keep reasoning_effort xhigh on Gemini and suffixed Claude ids - #47086

Open
seonghobae wants to merge 1 commit into
BerriAI:mainfrom
seonghobae:fix/reasoning-effort-xhigh
Open

seonghobae wants to merge 1 commit into
BerriAI:mainfrom
seonghobae:fix/reasoning-effort-xhigh

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • Gemini 3+ and the Gemini 2.5 budget map reject reasoning_effort=xhigh with UnsupportedParamsError, even though the API has no level above high. Map xhigh to that ceiling instead of failing the request.
  • Claude ids that only add an effort suffix, such as claude-sonnet-5-5-high, missed the base entry's supports_xhigh_reasoning_effort flag and raised effort='xhigh' is not supported. Look that suffix up against the base id so the flag is inherited. Models that still do not advertise xhigh, including claude-sonnet-4-6, keep the existing rejection.

Test plan

  • pytest tests/unit/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py::test_reasoning_effort_maps_to_thinking_level_gemini_3
  • pytest tests/unit/llms/anthropic/chat/test_anthropic_chat_transformation.py::test_effort_alias_suffix_inherits_base_model_xhigh
  • pytest tests/unit/llms/anthropic/chat/test_anthropic_chat_transformation.py::test_validate_effort_for_model_centralises_per_model_gating

Made with Cursor

Gemini has no thinking level above high, so xhigh was a 400. Claude ids with an effort suffix such as claude-sonnet-5-5-high now inherit the base model's xhigh flag.
@codspeed

codspeed Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 32 untouched benchmarks


Comparing seonghobae:fix/reasoning-effort-xhigh (ece58bb) with main (a4e0570)

Open in CodSpeed

@BrickerP BrickerP left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice coverage for bare …-high / Gemini xhigh→high. One gap in _model_map_lookup_candidates: the suffix transforms are applied independently to each primary candidate, not composed.

So claude-sonnet-5-5-20260219-high yields …-20260219-high and …-20260219, but never the undated base claude-sonnet-5-5 that actually owns supports_xhigh_reasoning_effort. Dated + effort-alias ids therefore still miss the capability flag this PR is trying to preserve.

Same shape already exists for other pairs (e.g. date + bedrock version), but this PR is specifically about effort aliases — worth either chaining effort-strip then re-running the other normalizers on that result, or adding a regression test for a dated …-YYYYMMDD-high / …-xhigh id.

_BEDROCK_VERSION_SUFFIX_RE.sub("", cand),
_INFERENCE_PROFILE_MINOR_RE.sub("", cand),
_DATED_RELEASE_SUFFIX_RE.sub("", cand),
_EFFORT_ALIAS_SUFFIX_RE.sub("", cand),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effort strip here is only applied to primary candidates. After this produces claude-sonnet-5-5-20260219 from …-20260219-high, nothing runs _DATED_RELEASE_SUFFIX_RE on that result, so the cost-map base never appears. Consider composing (effort → then date/bedrock/etc.) or at least a test for dated+effort aliases.

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ProjectBetelgeuse

Copy link
Copy Markdown

Now the hydrogen is out. The support for the xhigh is still missing. Any update on this?

This branch has not been deployed

No deployments
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.

3 participants