mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-30 01:52:18 +00:00
fix(bedrock): beta header filtering for Opus 4.7
- Filter user-provided beta headers through provider config (invoke path) - Use correct provider="bedrock_converse" for converse API beta filtering - Strip context-1m-2025-08-07 beta for Opus 4.7 (native 1M context)
This commit is contained in:
parent
36ed5b9a40
commit
61118c9ab1
4 changed files with 12 additions and 3 deletions
|
|
@ -92,7 +92,6 @@ BEDROCK_COMPUTER_USE_TOOLS = [
|
|||
]
|
||||
|
||||
|
||||
|
||||
class AmazonConverseConfig(BaseConfig):
|
||||
"""
|
||||
Reference - https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
||||
|
|
@ -1521,7 +1520,7 @@ class AmazonConverseConfig(BaseConfig):
|
|||
if anthropic_beta_list and base_model.startswith("anthropic"):
|
||||
filtered_betas = filter_and_transform_beta_headers(
|
||||
beta_headers=anthropic_beta_list,
|
||||
provider="bedrock",
|
||||
provider="bedrock_converse",
|
||||
)
|
||||
if filtered_betas:
|
||||
additional_request_params["anthropic_beta"] = filtered_betas
|
||||
|
|
|
|||
|
|
@ -319,7 +319,11 @@ class AmazonAnthropicClaudeConfig(AmazonInvokeConfig, AnthropicConfig):
|
|||
beta_headers=list(beta_set - user_beta_set),
|
||||
provider="bedrock",
|
||||
)
|
||||
return sorted(user_beta_set.union(set(auto_beta_list)))
|
||||
filtered_user_betas = filter_and_transform_beta_headers(
|
||||
beta_headers=list(user_beta_set),
|
||||
provider="bedrock",
|
||||
)
|
||||
return sorted(set(filtered_user_betas).union(set(auto_beta_list)))
|
||||
|
||||
def _convert_document_url_sources_to_base64(self, anthropic_request: dict) -> None:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -525,6 +525,12 @@ class AmazonAnthropicClaudeMessagesConfig(
|
|||
dropped_user_betas,
|
||||
)
|
||||
|
||||
# Opus 4.7+ has native 1M context on Bedrock — strip the legacy beta
|
||||
if any(
|
||||
p in model.lower() for p in ("opus-4.7", "opus_4.7", "opus-4-7", "opus_4_7")
|
||||
):
|
||||
filtered_betas = [b for b in filtered_betas if b != "context-1m-2025-08-07"]
|
||||
|
||||
return filtered_betas
|
||||
|
||||
def _strip_unsupported_bedrock_invoke_fields(
|
||||
|
|
|
|||
0
litellm/proxy/types_utils/__init__.py
Normal file
0
litellm/proxy/types_utils/__init__.py
Normal file
Loading…
Add table
Reference in a new issue