-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
[Feat]Add day 0 claude sonnet 4.6 feat support #21448
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
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2bbae68
Add sonnet-4.6 for tool use
Sameerlite 0cb56c9
Add mapping for thinking and response format
Sameerlite bdba316
Add inference_geo: us costing
Sameerlite 892b9ac
Add other provider feats
Sameerlite e0b28a1
Add other provider feats
Sameerlite f6d3919
Merge branch 'main' into litellm_sonnet_4_6_feat
Sameerlite 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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -251,6 +251,11 @@ def _supports_tool_search_on_bedrock(self, model: str) -> bool: | |||||
| "opus_4.6", | ||||||
| "opus-4-6", | ||||||
| "opus_4_6", | ||||||
| #sonnet 4.6 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing space in comment Minor formatting issue — existing comments in this list use
Suggested change
|
||||||
| "sonnet-4.6", | ||||||
| "sonnet_4.6", | ||||||
| "sonnet-4-6", | ||||||
| "sonnet_4_6", | ||||||
| ] | ||||||
|
|
||||||
| return any(pattern in model_lower for pattern in supported_patterns) | ||||||
|
|
@@ -285,7 +290,7 @@ def _get_tool_search_beta_header_for_bedrock( | |||||
| programmatic_tool_calling_used or input_examples_used | ||||||
| ): | ||||||
| beta_set.discard(ANTHROPIC_TOOL_SEARCH_BETA_HEADER) | ||||||
| if "opus-4" in model.lower() or "opus_4" in model.lower(): | ||||||
| if self._supports_tool_search_on_bedrock(model): | ||||||
| beta_set.add("tool-search-tool-2025-10-19") | ||||||
|
|
||||||
| def _convert_output_format_to_inline_schema( | ||||||
|
|
@@ -420,10 +425,8 @@ def transform_anthropic_messages_request( | |||||
| beta_set=beta_set, | ||||||
| ) | ||||||
|
|
||||||
| # --- Custom logic: if tool-search-tool-2025-10-19 is present, add tool-examples-2025-10-29 --- | ||||||
| if "tool-search-tool-2025-10-19" in beta_set: | ||||||
| beta_set.add("tool-examples-2025-10-29") | ||||||
| # ------------------------------------------------------------------------------ | ||||||
|
|
||||||
| if beta_set: | ||||||
| anthropic_messages_request["anthropic_beta"] = list(beta_set) | ||||||
|
|
||||||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading method name and docstring
The method
_is_claude_opus_4_6now also checks for Sonnet 4.6 models, but the name still says "opus". The docstring was updated to mention "Sonnet 4.6" but still says "Opus 4.5" instead of "Opus 4.6". This causes confusion at all 3 call sites (lines 713, 1293). Consider renaming to something like_is_adaptive_thinking_modelor_is_claude_4_6_familyto accurately reflect what it checks.Additionally, the
_is_claude_opus_4_6method is missing the dot-separated variants ("sonnet-4.6","opus-4.6"). The Bedrock_supports_tool_search_on_bedrockmethod and theresponse_formatcheck both include these dot variants, but this method does not. Models likevercel_ai_gateway/anthropic/claude-opus-4.6in the pricing JSON use dot separators and would not be matched.