Repository navigation
fix(anthropic): make thinking off reachable and report dropped sampling params - #1131
Merged
Merged
Conversation
10 of 13 tasks
…ng params reasoning_effort: :none sent no thinking field, so Claude models that think by default (Sonnet 5.5, Opus 5, Haiku 5.5) kept thinking at their default effort. It now sends the model's off switch: "disabled" where the model accepts it, "between_tools" on Sonnet 5.5. Opus 5.5 cannot turn thinking off, so :none there returns a warning instead. The Anthropic adapter shared by Bedrock, Vertex AI and Azure emitted only "enabled" and "adaptive" thinking and silently dropped "disabled" and "between_tools", so thinking could not be turned off on those platforms at all. Off types are now sent as the bare type, survive forced tool choice and temperature cleanup, and an explicit off config is normalized to the type the model accepts. Hosted entries with no thinking metadata resolve it from the native Anthropic model, and the "in." Bedrock inference prefix now resolves too. temperature, top_p and top_k were removed without a warning when the model rejects them. translate_options now returns a warning for every dropped or adjusted sampling parameter, and platform pre-validation forwards them. Models that require adaptive thinking (Opus 4.7 and later) drop sampling parameters even when hosted metadata lacks the temperature flag, since the API rejects them with a 400. Telemetry counted adaptive thinking as disabled. It now reports adaptive as enabled, with its effort, and between_tools as disabled.
neilberkman
force-pushed
the
fix/anthropic-thinking-off
branch
from
October 21, 2026 17:31
48cb9df to
ae187e1
Compare
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.
Description
Three gaps made thinking and sampling settings on Claude models silently wrong. All three are on main.
reasoning_effort: :nonesent nothinkingfield. Sonnet 5.5, Opus 5 and Haiku 5.5 think by default, so they kept thinking at their default effort.:nonenow sends the model's off switch:"disabled"where the model accepts it,"between_tools"on Sonnet 5.5. Opus 5.5 cannot turn thinking off, so:nonethere returns a warning."enabled"and"adaptive"thinking. It dropped"disabled"and"between_tools", so thinking could not be turned off on those platforms at all. Off types are now sent as the bare type, kept through forced tool choice and temperature cleanup, and an explicit off config becomes the type the model accepts.temperature,top_pandtop_kwere removed without a warning when the model rejects them.translate_optionsnow returns a warning for each dropped or adjusted sampling parameter, and platform pre-validation forwards them.Also in this PR:
in.Bedrock inference prefix now resolves too.temperatureflag, since the API rejects them with a 400.between_toolsas disabled.Verified on the wire against Bedrock InvokeModel and Converse:
reasoning_effort: :nonethinking: {type: between_tools}:nonethinking: {type: disabled}:nonetemperature: 0.0:nonewith tools (Converse)additionalModelRequestFields.thinking: {type: between_tools}temperature: 0.0temperature: 0.0Before this change, Bedrock returned 400 for
temperature: 0on Sonnet 5, Sonnet 5.5, Opus 4.7, Opus 4.8, Opus 5, Opus 5.5 and Haiku 5.5, and returned 400 forthinking: disabledon Sonnet 5.5 and Opus 5.5.The companion llm_db PR (agentjido/llmdb#367) copies native Claude reasoning metadata onto hosted entries. This PR works with the released llm_db through the native fallback.
Type of Change
Breaking Changes
None to the request surface. Two behaviour changes for callers:
reasoning_effort: :noneon Opus 4.7 and 4.8 now sendsthinking: {type: disabled}explicitly. Those models already ran without thinking when the field was omitted, so the outcome is unchanged.on_unsupported: :error, a dropped sampling parameter on direct Anthropic now raises. On Bedrock, Vertex AI and Azure the warnings come frompre_validate_options, whichOptionslogs but does not enforce (the rule from V1: Harden canonical cross-provider reasoning options #843), so they log there instead of raising.Testing
mix test): 5334 passedmix quality)Checklist
CHANGELOG.md(it is auto-generated by git_ops)Related Issues
None filed.