mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
feat(bedrock): add context_management support for Anthropic models on Bedrock Converse
Fixes #21912 Add context_management to supported params and pass-through in map_openai_params for Anthropic models on Bedrock Converse API. The parameter flows into additionalModelRequestFields automatically. The beta header (context-management-2025-06-27) is already supported in anthropic_beta_headers_config.json for bedrock_converse.
This commit is contained in:
parent
3561bfb96c
commit
5b7826d8a0
1 changed files with 8 additions and 0 deletions
|
|
@ -577,6 +577,11 @@ class AmazonConverseConfig(BaseConfig):
|
|||
):
|
||||
supported_params.append("thinking")
|
||||
supported_params.append("reasoning_effort")
|
||||
|
||||
# Anthropic models on Bedrock support context_management
|
||||
if base_model.startswith("anthropic"):
|
||||
supported_params.append("context_management")
|
||||
|
||||
return supported_params
|
||||
|
||||
def map_tool_choice_values(
|
||||
|
|
@ -942,6 +947,9 @@ class AmazonConverseConfig(BaseConfig):
|
|||
optional_params = self._add_tools_to_optional_params(
|
||||
optional_params=optional_params, tools=[grounding_tool]
|
||||
)
|
||||
if param == "context_management" and isinstance(value, dict):
|
||||
# Pass through Anthropic-specific context_management parameter
|
||||
optional_params["context_management"] = value
|
||||
|
||||
# Only update thinking tokens for non-GPT-OSS models and non-Nova-Lite-2 models
|
||||
# Nova 2 handles token budgeting differently through reasoningConfig
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue