Skip to content

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]

add test_audio_speech_litellm_vertex

Ishaan Jaff960a141884e8
diff --git a/litellm/tests/speech_vertex.mp3 b/litellm/tests/speech_vertex.mp3
new file mode 100644
index 00000000000..c676110335e
Binary files /dev/null and b/litellm/tests/speech_vertex.mp3 differ
diff --git a/litellm/tests/test_audio_speech.py b/litellm/tests/test_audio_speech.py
index 285334f7ef4..5e0cf607796 100644
--- a/litellm/tests/test_audio_speech.py
+++ b/litellm/tests/test_audio_speech.py
@@ -117,3 +117,39 @@ async def test_audio_speech_router(mode):
from litellm.llms.openai import HttpxBinaryResponseContent
assert isinstance(response, HttpxBinaryResponseContent)
+
+
+ "sync_mode",
+ [False],
+)
+async def test_audio_speech_litellm_vertex(sync_mode):
+ litellm.set_verbose = True
+ speech_file_path = Path(__file__).parent / "speech_vertex.mp3"
+ model = "vertex_ai/test"
+ if sync_mode:
+ response = litellm.speech(
+ model=model,
+ voice="alloy",
+ input="hello what llm guardrail do you have",
+ )
+
+ from types import SimpleNamespace
+
+ from litellm.llms.openai import HttpxBinaryResponseContent
+
+ response.stream_to_file(speech_file_path)
+
+ else:
+ response = await litellm.aspeech(
+ model=model,
+ voice="alloy",
+ input="async hello what llm guardrail do you have",
+ )
+
+ from types import SimpleNamespace
+
+ from litellm.llms.openai import HttpxBinaryResponseContent
+
+ response.stream_to_file(speech_file_path)