From b910ae47e72dd2ae38b5cc30d5d19c6ea7d67f6e Mon Sep 17 00:00:00 2001 From: Chesars Date: Sat, 25 Apr 2026 18:00:00 -0300 Subject: [PATCH] fix(mypy): widen file-ref helper input type, annotate empty list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _resolve_file_references / _async_resolve_file_references: param type EmbeddingInput → Union[EmbeddingInput, List[str]]. Two of the four call sites pass flat_elements (List[str]) post-410f54dc72; the function body already handles both shapes at runtime — only the type was lying. - transform_openai_input_gemini_content: annotate text_elements as List[str] for the var-annotated rule. --- .../gemini_embeddings/batch_embed_content_handler.py | 4 ++-- .../gemini_embeddings/batch_embed_content_transformation.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py b/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py index 38fdbd8f1b..1743122753 100644 --- a/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py +++ b/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py @@ -48,7 +48,7 @@ class GoogleBatchEmbeddings(VertexLLM): def _resolve_file_references( self, - input: EmbeddingInput, + input: Union[EmbeddingInput, List[str]], api_key: str, sync_handler: HTTPHandler, ) -> Dict[str, Dict[str, str]]: @@ -87,7 +87,7 @@ class GoogleBatchEmbeddings(VertexLLM): async def _async_resolve_file_references( self, - input: EmbeddingInput, + input: Union[EmbeddingInput, List[str]], api_key: str, async_handler: AsyncHTTPHandler, ) -> Dict[str, Dict[str, str]]: diff --git a/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py b/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py index a1a53a4e71..11457fc924 100644 --- a/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py +++ b/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py @@ -361,7 +361,7 @@ def process_response( has_nested = isinstance(input, list) and any(isinstance(e, list) for e in input) if _is_multimodal_input(input) or has_nested: input_list = input if isinstance(input, list) else [input] - text_elements = [] + text_elements: List[str] = [] for e in input_list: if isinstance(e, list): text_elements.extend(