Skip to content

fix(anthropic): move thinking effort to output_config#295

Merged
Kamilbenkirane merged 1 commit into
mainfrom
fix/anthropic-adaptive-effort
Jul 2, 2026
Merged

fix(anthropic): move thinking effort to output_config#295
Kamilbenkirane merged 1 commit into
mainfrom
fix/anthropic-adaptive-effort

Conversation

@Kamilbenkirane

Copy link
Copy Markdown
Member

What

Setting thinking_level on an Anthropic model produces a request the Messages API rejects:

anthropic API error: thinking.adaptive.effort: Extra inputs are not permitted

ThinkingLevelMapper embeds the effort level inside the thinking object — {"thinking": {"type": "adaptive", "effort": "high"}} — but the finalized API only accepts type and display there. Effort belongs in the top-level output_config parameter.

Fix

The mapper now emits:

{"thinking": {"type": "adaptive"}, "output_config": {"effort": "high"}}

output_config is written via setdefault so future fields (e.g. format) compose. Docstrings updated in both the provider mapper and its text-modality subclass.

Verification

  • make lint clean; pre-push mypy/ruff/bandit hooks pass.
  • make test: 682 passed (with --all-extras; the vertex-routing tests need the google extra installed).

The Messages API rejects an effort key inside the adaptive thinking
object (thinking.adaptive.effort: Extra inputs are not permitted).
thinking_level now emits {"thinking": {"type": "adaptive"},
"output_config": {"effort": <level>}} instead, which is where the
finalized API accepts it. setdefault on output_config so future
output_config fields (e.g. format) compose.
@Kamilbenkirane Kamilbenkirane merged commit 96b0956 into main Jul 2, 2026
11 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.

1 participant