test(gemini): run TTS regressions in CI shards

This commit is contained in:
Emerson Gomes 2026-09-23 05:34:20 -05:00
parent f5c6223bf1
commit 0883607cb3
No known key found for this signature in database
GPG key ID: D3DF28AB5D1B5E17
6 changed files with 9 additions and 20 deletions

View file

@ -11,6 +11,8 @@ from litellm.endpoints.speech.speech_to_completion_bridge.transformation import
)
from litellm.types.utils import ChatCompletionAudioResponse, Choices, Message, ModelResponse
pytestmark = pytest.mark.usefixtures("local_model_cost_map")
GEMINI_TTS_MODEL: Final = "gemini-3.1-flash-tts-preview"
PCM_BYTES: Final = b"\x01\x02\x03\x04" * 6

View file

@ -12,6 +12,8 @@ from litellm.endpoints.speech.speech_to_completion_bridge.transformation import
from litellm.llms.gemini.chat.transformation import GoogleAIStudioGeminiConfig
from litellm.utils import get_supported_openai_params
pytestmark = pytest.mark.usefixtures("local_model_cost_map")
GEMINI_3_1_FLASH_TTS_MODEL = "gemini-3.1-flash-tts-preview"
MULTI_SPEAKER_SPEECH_CONFIG = {
@ -187,7 +189,6 @@ class TestGeminiTTSTransformation:
assert result["speechConfig"] == NORMALIZED_MULTI_SPEAKER_SPEECH_CONFIG
assert result["responseModalities"] == ["AUDIO"]
assert "temperature" not in result
def test_gemini_tts_audio_parameter_with_existing_modalities(self):
"""Test audio parameter mapping when modalities already exist"""
@ -488,7 +489,6 @@ class TestGeminiTTSSpeechConfigInRequestBody:
generation_config = request_body["generationConfig"]
assert generation_config["speechConfig"] == NORMALIZED_MULTI_SPEAKER_SPEECH_CONFIG
assert generation_config["responseModalities"] == ["AUDIO"]
assert "temperature" not in generation_config
@pytest.mark.parametrize(
"model,custom_llm_provider",

View file

@ -13,6 +13,8 @@ from litellm.llms.vertex_ai.text_to_speech.transformation import (
from litellm.types.utils import LlmProviders
from litellm.utils import ProviderConfigManager
pytestmark = pytest.mark.usefixtures("local_model_cost_map")
class TestVertexAITextToSpeechConfig:
"""Tests for VertexAITextToSpeechConfig transformation"""

View file

@ -6,6 +6,8 @@ import pytest
import litellm
from litellm.utils import _invalidate_model_cost_lowercase_map, is_gemini_tts_model
pytestmark = pytest.mark.usefixtures("local_model_cost_map")
EXPECTED_MODELS = {
"gemini-3.1-flash-tts-preview": "gemini",
"gemini/gemini-3.1-flash-tts-preview": "gemini",
@ -27,24 +29,7 @@ def test_gemini_3_1_flash_tts_model_metadata(model, provider):
assert info["litellm_provider"] == provider
assert info["mode"] == "audio_speech"
assert info["input_cost_per_token"] == 1e-06
assert info["output_cost_per_token"] == 2e-05
assert info["max_input_tokens"] == 8192
assert info["max_output_tokens"] == 16384
assert info["max_tokens"] == 16384
assert info["supported_endpoints"] == ["/v1/audio/speech"]
if model == "gemini/gemini-3.1-flash-tts-preview":
assert info["rpm"] == 10
assert info["tpm"] == 4000000
else:
assert info["output_cost_per_audio_token"] == 2e-05
assert info["supported_modalities"] == ["text"]
assert info["supported_output_modalities"] == ["audio"]
assert info["supports_audio_input"] is False
assert info["supports_audio_output"] is True
assert info["supports_function_calling"] is False
assert info["supports_prompt_caching"] is False
assert "/v1/audio/speech" in info["supported_endpoints"]
def test_gemini_3_1_flash_tts_backup_matches_main():