-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
fix(bedrock): normalize Messages system role and adaptive-thinking for Claude Invoke #31364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mateo-berri
merged 12 commits into
litellm_internal_staging
from
litellm_bedrock_advisor_adaptive_thinking
Jun 27, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3ffc9c1
fix(bedrock): normalize Messages system role and adaptive-thinking fo…
mateo-berri d268ee0
style(bedrock): use builtin generics in new Invoke helpers to clear U…
mateo-berri fb1fcb8
fix(bedrock): honor explicit thinking budget_tokens=0 in clear_thinki…
mateo-berri 396fbfa
fix(bedrock): gate Fable 5 into clear_thinking adaptive injection on …
mateo-berri 567791a
refactor(anthropic): make supports_adaptive_thinking flag authoritati…
mateo-berri 92fb5c7
refactor(anthropic): drop name-based version fallback; resolve adapti…
mateo-berri bf5e862
refactor(reasoning_effort): single-source effort<->thinking-budget ma…
mateo-berri f3b0cd7
test(reasoning_effort): lift budget-mode max_tokens above the new hig…
mateo-berri 824ad8d
fix(reasoning_effort): keep effort<->budget thresholds at pre-PR values
mateo-berri dd2a8f8
test(reasoning_effort): derive high effort->budget assertions from th…
mateo-berri 1580ca3
fix(anthropic): resolve adaptive flag for combined dated+versioned Be…
mateo-berri 5cf377a
fix(reasoning_effort): align budget<->effort tests with reverted cons…
mateo-berri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| from typing import Literal | ||
|
|
||
| from litellm.constants import ( | ||
| DEFAULT_REASONING_EFFORT_HIGH_THINKING_BUDGET, | ||
| DEFAULT_REASONING_EFFORT_LOW_THINKING_BUDGET, | ||
| DEFAULT_REASONING_EFFORT_MEDIUM_THINKING_BUDGET, | ||
| ) | ||
|
|
||
| OpenAIStyleReasoningEffort = Literal["minimal", "low", "medium", "high"] | ||
|
|
||
|
|
||
| def reasoning_effort_from_thinking_budget( | ||
| budget_tokens: int, | ||
| ) -> OpenAIStyleReasoningEffort: | ||
| """Bucket an Anthropic ``thinking.budget_tokens`` into an OpenAI-style | ||
| ``reasoning_effort`` using the shared ``DEFAULT_REASONING_EFFORT_*_THINKING_BUDGET`` | ||
| thresholds, so every backend that translates a budget into an effort label | ||
| reads the same numbers. | ||
| """ | ||
| if budget_tokens >= DEFAULT_REASONING_EFFORT_HIGH_THINKING_BUDGET: | ||
| return "high" | ||
| if budget_tokens >= DEFAULT_REASONING_EFFORT_MEDIUM_THINKING_BUDGET: | ||
| return "medium" | ||
| if budget_tokens >= DEFAULT_REASONING_EFFORT_LOW_THINKING_BUDGET: | ||
| return "low" | ||
| return "minimal" |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.