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]

refactor(speech): type the bridge voice param as a mapping and wrap a long test line

mateo-berrif269b52a1591
diff --git a/litellm/endpoints/speech/speech_to_completion_bridge/transformation.py b/litellm/endpoints/speech/speech_to_completion_bridge/transformation.py
index 5e38b644300..9b757ce86be 100644
--- a/litellm/endpoints/speech/speech_to_completion_bridge/transformation.py
+++ b/litellm/endpoints/speech/speech_to_completion_bridge/transformation.py
@@ -45,7 +45,7 @@ class SpeechToCompletionBridgeTransformationHandler:
return response_format if isinstance(response_format, str) else None
def _chat_audio_param(
- self, model: str, voice: str | dict | None, optional_params: Mapping[str, object]
+ self, model: str, voice: str | Mapping[str, object] | None, optional_params: Mapping[str, object]
) -> ChatAudioParam | None:
if not isinstance(voice, str):
return None
diff --git a/tests/test_litellm/endpoints/speech/speech_to_completion_bridge/test_transformation.py b/tests/test_litellm/endpoints/speech/speech_to_completion_bridge/test_transformation.py
index 9367d9d6d16..c0c720bbaf6 100644
--- a/tests/test_litellm/endpoints/speech/speech_to_completion_bridge/test_transformation.py
+++ b/tests/test_litellm/endpoints/speech/speech_to_completion_bridge/test_transformation.py
@@ -13,7 +13,9 @@ GEMINI_TTS_MODEL: Final = "gemini-3.1-flash-tts-preview"
def _bridge_request(response_format: str | None) -> dict:
- optional_params: Final = {"temperature": 0.4} if response_format is None else {"temperature": 0.4, "response_format": response_format}
+ optional_params: Final = (
+ {"temperature": 0.4} if response_format is None else {"temperature": 0.4, "response_format": response_format}
+ )
return SpeechToCompletionBridgeTransformationHandler().transform_request(
model=GEMINI_TTS_MODEL,
input="Hello from LiteLLM",