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: raise clear error when file references used without api_key
Chesars76d53fe86140
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.pyindex a3d681ea515..efd77f5916c 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@@ -214,6 +214,15 @@ class GoogleBatchEmbeddings(VertexLLM):resolved_files=resolved_files,)else:+ input_list = [input] if isinstance(input, str) else input+ has_file_refs = any(+ _is_file_reference(e) for e in input_list if isinstance(e, str)+ )+ if has_file_refs and not api_key:+ raise ValueError(+ "An API key is required to resolve Gemini file references (files/...). "+ "Pass api_key= or set GEMINI_API_KEY."+ )resolved_files = {}if api_key and _is_multimodal_input(input):resolved_files = self._resolve_file_references(@@ -310,6 +319,15 @@ class GoogleBatchEmbeddings(VertexLLM):resolved_files=resolved_files,)else:+ input_list = [input] if isinstance(input, str) else input+ has_file_refs = any(+ _is_file_reference(e) for e in input_list if isinstance(e, str)+ )+ if has_file_refs and not api_key:+ raise ValueError(+ "An API key is required to resolve Gemini file references (files/...). "+ "Pass api_key= or set GEMINI_API_KEY."+ )resolved_files = {}if api_key and _is_multimodal_input(input):resolved_files = await self._async_resolve_file_references(