Skip to content

feat: add Claude adaptive thinking effort support for Bedrock Converse#22

Open
SalemBajjali wants to merge 6 commits into
issue-17from
issue-9
Open

feat: add Claude adaptive thinking effort support for Bedrock Converse#22
SalemBajjali wants to merge 6 commits into
issue-17from
issue-9

Conversation

@SalemBajjali

Copy link
Copy Markdown
Contributor

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.

@SalemBajjali SalemBajjali requested a review from a team as a code owner June 25, 2026 18:55
@SalemBajjali SalemBajjali requested review from anastasiabratulin, korikuzma and mcannon068nw and removed request for a team June 25, 2026 18:55
@SalemBajjali SalemBajjali self-assigned this Jun 25, 2026
@SalemBajjali SalemBajjali added the priority:medium Medium priority label Jun 25, 2026
)

_logger = logging.getLogger(__name__)
_VALID_EFFORT_LEVELS = ("high", "medium", "low")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use an enum here?

: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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should additionalModelRequestFields only be added if effort is provided?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants