feat: add Claude adaptive thinking effort support for Bedrock Converse#22
Open
SalemBajjali wants to merge 6 commits into
Open
feat: add Claude adaptive thinking effort support for Bedrock Converse#22SalemBajjali wants to merge 6 commits into
SalemBajjali wants to merge 6 commits into
Conversation
korikuzma
requested changes
Jun 26, 2026
| ) | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
| _VALID_EFFORT_LEVELS = ("high", "medium", "low") |
| :param max_tokens: Maximum number of tokens to request from the model. | ||
| :param temperature: Sampling temperature. | ||
| :param effort: Optional adaptive thinking effort level for supported Claude models using Bedrock Converse: "high", "medium", "low", or None to use the model default. | ||
| :raise LLMInvalidEffortError: If effort is not "high", "medium", "low", or None. |
Member
There was a problem hiding this comment.
IIRC, this was a claude-specific parameter. I think the custom error should live in this module. If I'm wrong, then we can leave it where its at
Comment on lines
+112
to
+117
| adaptive_thinking_params: dict[str, Any] = {"thinking": {"type": "adaptive"}} | ||
| if self.effort: | ||
| adaptive_thinking_params["output_config"] = {"effort": self.effort} | ||
|
|
||
| converse_params["additionalModelRequestFields"] = adaptive_thinking_params | ||
|
|
Member
There was a problem hiding this comment.
Should additionalModelRequestFields only be added if effort is provided?
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.
Closes #9
I followed the AWS Bedrock Converse documentation for adaptive thinking:
The implementation adds the required thinking configuration and optional effort setting under additionalModelRequestFields, matching the Converse API example.
I also added tests to cover the new effort configuration.