diff --git a/litellm/llms/base_llm/anthropic_messages/transformation.py b/litellm/llms/base_llm/anthropic_messages/transformation.py index 733faca8532..49aa563781f 100644 --- a/litellm/llms/base_llm/anthropic_messages/transformation.py +++ b/litellm/llms/base_llm/anthropic_messages/transformation.py @@ -141,8 +141,9 @@ class BaseAnthropicMessagesConfig(ABC): is_anthropic_invalid_thinking_signature_error, ) - return e.response.status_code == 400 and is_anthropic_invalid_thinking_signature_error( - e.response.text + return ( + e.response.status_code == 400 + and is_anthropic_invalid_thinking_signature_error(e.response.text) ) def transform_anthropic_messages_request_on_http_error( @@ -156,8 +157,9 @@ class BaseAnthropicMessagesConfig(ABC): strip_thinking_blocks_from_anthropic_messages_request_dict, ) - if e.response.status_code == 400 and is_anthropic_invalid_thinking_signature_error( - e.response.text + if ( + e.response.status_code == 400 + and is_anthropic_invalid_thinking_signature_error(e.response.text) ): strip_thinking_blocks_from_anthropic_messages_request_dict(request_data) return request_data