diff --git a/litellm/llms/anthropic/pass_through/messages/handler.py b/litellm/llms/anthropic/pass_through/messages/handler.py index 4f7cc091c81..f777d706e19 100644 --- a/litellm/llms/anthropic/pass_through/messages/handler.py +++ b/litellm/llms/anthropic/pass_through/messages/handler.py @@ -435,7 +435,7 @@ def _drop_unsupported_anthropic_messages_params( supports_reasoning: Final = AnthropicConfig._supports_model_capability( model, "supports_reasoning", custom_llm_provider or "anthropic" ) - drop_context_management: Final = custom_llm_provider in ["vertex_ai", "bedrock"] and "haiku" in model.lower() + drop_context_management: Final = custom_llm_provider in ("vertex_ai", "bedrock") and "haiku" in model.lower() return MappingProxyType( { k: v @@ -695,7 +695,7 @@ def anthropic_messages_handler( MappingProxyType( { **filtered_anthropic_messages_params, - "thinking": { + "thinking": { # mutable-ok: construct the summarized payload before freezing **thinking_param, "display": "summarized", }, @@ -716,7 +716,9 @@ def anthropic_messages_handler( model=model, messages=strip_provider_specific_fields_from_anthropic_messages(messages), anthropic_messages_provider_config=anthropic_messages_provider_config, - anthropic_messages_optional_request_params=dict(final_anthropic_messages_params), + anthropic_messages_optional_request_params=dict( # mutable-ok: downstream handler requires a dict + final_anthropic_messages_params + ), _is_async=is_async, client=client, custom_llm_provider=custom_llm_provider,