From 9f1b470eeba0c13ce68fd8032bd15eac91b01c44 Mon Sep 17 00:00:00 2001 From: Ruiming Zhao Date: Fri, 14 Aug 2026 17:23:38 -0700 Subject: [PATCH] fix(anthropic): satisfy basedpyright on document block path --- litellm/litellm_core_utils/prompt_templates/factory.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 32510caa5fb..74f7da91052 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -2421,12 +2421,12 @@ def anthropic_messages_pt( url_str = ( image_url_value.get("url") if isinstance(image_url_value, dict) else image_url_value ) - if isinstance(url_str, str) and _is_anthropic_document_data_uri(url_str): - image_chunk: Final = convert_to_anthropic_image_obj( + if isinstance(url_str, str) and _is_anthropic_document_data_uri(url_str): # pyright: ignore[reportUnnecessaryIsInstance] # malformed payloads can carry a non-str url + image_chunk = convert_to_anthropic_image_obj( openai_image_url=url_str, format=None, ) - _document_content_element: Final = AnthropicMessagesDocumentParam( + _document_content_element = AnthropicMessagesDocumentParam( type="document", source=AnthropicContentParamSource( type="base64", @@ -2436,7 +2436,7 @@ def anthropic_messages_pt( ) add_cache_control_to_content( anthropic_content_element=_document_content_element, - original_content_element=m, + original_content_element=m, # pyright: ignore[reportArgumentType] # cache_control lives on the block ) user_content.append(_document_content_element) continue