Repository navigation
feat(anthropic): accept an effort level in ChatBedrockAnthropic(reasoning=) - #448
Merged
cpsievert merged 2 commits intoOct 12, 2026
Merged
Conversation
…ning=) `ChatBedrockAnthropic(reasoning=)` only took an int, which became a manual `budget_tokens` thinking config. Its default model, Claude Sonnet 5, rejects manual budgets, so there was no way to turn on thinking with that model. The translation `ChatAnthropic()` already does (effort string -> adaptive thinking plus `output_config.effort`, int -> fixed budget) moves into a shared `reasoning_kwargs()` helper that both functions call. The docstrings now say that fixed budgets only work on models before Claude Opus 4.6 / Sonnet 4.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BeNHkjF4spsH9d18UiYPiU
cpsievert
reviewed
Oct 12, 2026
cpsievert
reviewed
Oct 12, 2026
Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
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.
ChatBedrockAnthropic(reasoning=)only accepted an int, which became a manual{"type": "enabled", "budget_tokens": ...}thinking config. Its default model,us.anthropic.claude-sonnet-5, rejects manual budgets with a 400, as do Claude Opus 4.7 and later, so there was no way to turn on thinking with the default model.ChatAnthropic(reasoning=)already handles this. A string effort level enables adaptive thinking ({"type": "adaptive"}plusoutput_config.effort), and an int stays a fixed budget. This PR moves that translation into a smallreasoning_kwargs()helper that both functions call, soChatBedrockAnthropicaccepts the same forms:The two docstrings also say that fixed budgets only work on models before Claude Opus 4.6 / Sonnet 4.6. That way someone on a current model reaches for an effort level instead of hitting the 400. This matches what ellmer does in
chat_claude()withreasoning_effort.Tests
TestReasoningintests/test_provider_anthropic_bedrock.pychecks that an effort string gives adaptive thinking and that an int still gives a fixed budget. With the change reverted, the effort test fails.tests/test_provider_anthropic.py,tests/test_provider_anthropic_bedrock.py,tests/test_provider_bedrock.py: 73 passed, 9 skipped (live Bedrock).ruff check,ruff format --check, andpyright chatlas/_provider_anthropic.pyare clean.I didn't run a live Bedrock request, so the new path is covered by the unit test and by
ChatAnthropicalready sending the same request shape.🤖 Generated with Claude Code
https://claude.ai/code/session_01BeNHkjF4spsH9d18UiYPiU