mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
Handle both OpenAI list and Anthropic dict formats for context_management
Use AnthropicConfig.map_openai_context_management_to_anthropic() to transform OpenAI list format to Anthropic dict format, consistent with the direct Anthropic provider implementation.
This commit is contained in:
parent
5b7826d8a0
commit
b4942942b9
1 changed files with 9 additions and 3 deletions
|
|
@ -947,9 +947,15 @@ 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
|
||||
if param == "context_management" and isinstance(value, (list, dict)):
|
||||
# Supports both OpenAI list format and Anthropic dict format
|
||||
anthropic_context_management = (
|
||||
AnthropicConfig.map_openai_context_management_to_anthropic(value)
|
||||
)
|
||||
if anthropic_context_management is not None:
|
||||
optional_params["context_management"] = (
|
||||
anthropic_context_management
|
||||
)
|
||||
|
||||
# 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