Extended thinking support for bedrock models#56
Open
sarisha19 wants to merge 2 commits into
Open
Conversation
jsdps
reviewed
Apr 23, 2025
| if "type" in thinking_params: | ||
| if thinking_params["type"] == "enabled": | ||
| # Fix temperature and unset top p for thinking mode | ||
| model_params.temperature = 1.0 |
There was a problem hiding this comment.
This transformation can be skipped - it'd silently update the values for compliance and can lead to unexpected results. If the input config is not supported, the user should be the one to fix it
jsdps
reviewed
Apr 23, 2025
| elif "budget_tokens" in thinking_params: | ||
| # Remove budget tokens if thinking is disabled | ||
| model_params.additional_model_request_fields["thinking"].pop("budget_tokens") | ||
| else: |
There was a problem hiding this comment.
Should we avoid this else block? If a new bedrock model is launched that supports streaming, then you'd be removing the thinking params passed in the llm-config until EXTENDED_THINKING_MODELS is updated in this code
Not having this allows the values to pass through to converse-client creation, and if its an error on the application side if they send these params when they were not supposed to be, then the client creation will just fail - as expected
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 of changes:
thinking_params, consumed by Bedrock models which support Extended thinking(Only Claude 3.7 currently).-Tested with non-thinking models, thinking models(valid and invalid parameters) and with custom model.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.