The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: update EmbeddingInput type, validate nested sub-elements, add tests
Chesars960108939d7b
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.pyindex 5777948c4f6..66ff9ef987c 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@@ -216,6 +216,13 @@ def transform_openai_input_gemini_content(for element in input_list:if isinstance(element, list):+ if not element:+ raise ValueError("Nested input list must not be empty")+ for sub in element:+ if not isinstance(sub, str):+ raise ValueError(+ f"Elements inside a nested input list must be strings, got {type(sub)}"+ )parts = [_build_part_for_input(sub, resolved_files=resolved_files)for sub in elementdiff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.pyindex 5a80b40d61f..79bfe73d12e 100644--- a/litellm/types/llms/openai.py+++ b/litellm/types/llms/openai.py@@ -103,7 +103,7 @@ FileTypes = Union[]-EmbeddingInput = Union[str, List[str]]+EmbeddingInput = Union[str, List[Union[str, List[str]]]]class HttpxBinaryResponseContent(_HttpxBinaryResponseContent):diff --git a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.pyindex 98b2c0167af..7e757e32e0e 100644--- a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py+++ b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py@@ -44,6 +44,12 @@ class TestIsMultimodalInput:def test_mixed_text_and_image(self):assert _is_multimodal_input(["hello", IMAGE_DATA_URI]) is True+ def test_nested_list_is_multimodal(self):+ assert _is_multimodal_input([["text_a", "text_b"]]) is True++ def test_nested_list_with_image_is_multimodal(self):+ assert _is_multimodal_input([["a red shoe", IMAGE_DATA_URI]]) is True+class TestBuildPartForInput:def test_text_input(self):