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
[Bug Fix] Add audio/ogg mapping for Audio MIME types (#11635)
Ishaan Jaff91010cda8f0f
diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.pyindex acac97bd3e9..a4ba25fc466 100644--- a/litellm/litellm_core_utils/prompt_templates/common_utils.py+++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py@@ -116,7 +116,7 @@ def strip_none_values_from_message(message: AllMessageValues) -> AllMessageValuedef convert_content_list_to_str(- message: Union[AllMessageValues, ChatCompletionResponseMessage]+ message: Union[AllMessageValues, ChatCompletionResponseMessage],) -> str:"""- handles scenario where content is list and not string@@ -532,6 +532,7 @@ def _get_image_mime_type_from_url(url: str) -> Optional[str]:audio/mpegaudio/mp3audio/wav+ audio/oggimage/pngimage/jpegimage/webp@@ -565,6 +566,7 @@ def _get_image_mime_type_from_url(url: str) -> Optional[str]:(".mp3",): "audio/mp3",(".wav",): "audio/wav",(".mpeg",): "audio/mpeg",+ (".ogg",): "audio/ogg",# Documents(".pdf",): "application/pdf",(".txt",): "text/plain",@@ -621,7 +623,6 @@ def get_file_ids_from_messages(messages: List[AllMessageValues]) -> List[str]:return file_ids-def check_is_function_call(logging_obj: "LoggingClass") -> bool:from litellm.litellm_core_utils.prompt_templates.common_utils import (is_function_call,@@ -635,6 +636,7 @@ def check_is_function_call(logging_obj: "LoggingClass") -> bool:return False+def filter_value_from_dict(dictionary: dict, key: str, depth: int = 0) -> Any:"""Filters a value from a dictionary@@ -686,5 +688,3 @@ def migrate_file_to_image_url(if format and isinstance(image_url_object["image_url"], dict):image_url_object["image_url"]["format"] = formatreturn image_url_object--diff --git a/tests/local_testing/test_amazing_vertex_completion.py b/tests/local_testing/test_amazing_vertex_completion.pyindex 6247b9816be..f74307ae28f 100644--- a/tests/local_testing/test_amazing_vertex_completion.py+++ b/tests/local_testing/test_amazing_vertex_completion.py@@ -3958,4 +3958,40 @@ def test_vertex_ai_gemini_2_5_pro_streaming():print(chunk)if chunk.choices[0].delta.content is not None and len(chunk.choices[0].delta.content) > 0:has_real_content = True- assert has_real_content\ No newline at end of file+ assert has_real_content+++def test_vertex_ai_gemini_audio_ogg():+ load_vertex_ai_credentials()+ litellm._turn_on_debug()+ response = completion(+ model="vertex_ai/gemini-2.0-flash",+ messages=[+ {+ "content": [+ {+ "text": "generate a transcript of the speech.",+ "type": "text"+ }+ ],+ "role": "user"+ },+ {+ "content": [+ {+ "file": {+ "file_id": "https://upload.wikimedia.org/wikipedia/commons/5/5f/En-us-public.ogg"+ },+ "type": "file"+ }+ ],+ "role": "user"+ }+ ],+ )+ print(response)+++++diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex.py b/tests/test_litellm/llms/vertex_ai/test_vertex.pyindex d4679b5ceb3..07b0cbc6234 100644--- a/tests/test_litellm/llms/vertex_ai/test_vertex.py+++ b/tests/test_litellm/llms/vertex_ai/test_vertex.py@@ -1218,6 +1218,10 @@ def test_get_image_mime_type_from_url():_get_image_mime_type_from_url("https://example.com/IMAGE.WEBP") == "image/webp")+ # Test audio formats+ assert _get_image_mime_type_from_url("https://example.com/audio.ogg") == "audio/ogg"+ assert _get_image_mime_type_from_url("https://example.com/track.OGG") == "audio/ogg"+# Test unsupported formatsassert _get_image_mime_type_from_url("https://example.com/image.gif") is Noneassert _get_image_mime_type_from_url("https://example.com/image.bmp") is None