From ffbbda6021ecd088d8c33a69745decde42ed94e8 Mon Sep 17 00:00:00 2001 From: benny <2000beni770@gmail.com> Date: Fri, 24 Jul 2026 21:22:35 +0300 Subject: [PATCH] fix(anthropic): use PEP 604 union to satisfy ruff strict-rule budget sanitize_tool_use_ids_in_anthropic_messages's new model param used Optional[str], which trips ruff's UP045 (prefer str | None) and pushed the strict-rule budget over its ceiling in CI. Switch to str | None, matching the style already used elsewhere in this same file. --- litellm/llms/anthropic/common_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/common_utils.py b/litellm/llms/anthropic/common_utils.py index 8ac9d7b3366..f33ee549215 100644 --- a/litellm/llms/anthropic/common_utils.py +++ b/litellm/llms/anthropic/common_utils.py @@ -1063,7 +1063,7 @@ def _sanitize_tool_use_id_content_block(block: Any, *, preserve_kimi_k2_ids: boo return block -def sanitize_tool_use_ids_in_anthropic_messages(messages: list[Any], model: Optional[str] = None) -> list[Any]: +def sanitize_tool_use_ids_in_anthropic_messages(messages: list[Any], model: str | None = None) -> list[Any]: """ Return a new message list with ``tool_use`` / ``server_tool_use`` ``id`` and ``tool_result`` ``tool_use_id`` values rewritten to satisfy Anthropic's