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
test: document gemini file URI handling
userdc3e0739fbaf
diff --git a/litellm/litellm_core_utils/url_utils.py b/litellm/litellm_core_utils/url_utils.pyindex fca157fce6d..a8720282afd 100644--- a/litellm/litellm_core_utils/url_utils.py+++ b/litellm/litellm_core_utils/url_utils.py@@ -67,7 +67,11 @@ def encode_url_path_segment(value: Any, *, field_name: str = "path parameter") -def encode_url_path_segments(value: Any, *, field_name: str = "path") -> str:- """Percent-encode a user-controlled URL path made of multiple segments."""+ """Percent-encode a user-controlled URL path made of multiple segments.++ Empty segments are rejected, so leading, trailing, or consecutive slashes+ fail closed instead of being normalized by the HTTP client.+ """if value is None:raise ValueError(f"{field_name} is required")diff --git a/tests/test_litellm/llms/gemini/files/test_gemini_files_transformation.py b/tests/test_litellm/llms/gemini/files/test_gemini_files_transformation.pyindex d262b3b96d8..a2f95724688 100644--- a/tests/test_litellm/llms/gemini/files/test_gemini_files_transformation.py+++ b/tests/test_litellm/llms/gemini/files/test_gemini_files_transformation.py@@ -320,9 +320,7 @@ class TestGoogleAIStudioFilesTransformation:litellm_params=litellm_params,)- # Verify URL extraction- assert "files/test123" in url- assert "generativelanguage.googleapis.com" in url+ assert url == "https://generativelanguage.googleapis.com/v1beta/files/test123"# Params should be empty (API key goes in header via validate_environment)assert params == {}