Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def __init__(
locals_ = locals().copy()
for key, value in locals_.items():
if key != "self" and value is not None:
setattr(self.__class__, key, value)
setattr(self, key, value)

@classmethod
def get_config(cls):
Expand Down Expand Up @@ -635,10 +635,7 @@ def _map_audio_params(self, value: dict) -> dict:
}
"""
from litellm.types.llms.vertex_ai import (
PrebuiltVoiceConfig,
SpeechConfig,
VoiceConfig,
)
SpeechConfig)

# Validate audio format - Gemini TTS only supports pcm16
audio_format = value.get("format")
Expand All @@ -649,15 +646,16 @@ def _map_audio_params(self, value: dict) -> dict:
f"Please set audio format to 'pcm16'."
)

# Map OpenAI audio parameter to Gemini speech config
speech_config: SpeechConfig = {}

if "voice" in value:
prebuilt_voice_config: PrebuiltVoiceConfig = {"voiceName": value["voice"]}
voice_config: VoiceConfig = {"prebuiltVoiceConfig": prebuilt_voice_config}
speech_config["voiceConfig"] = voice_config

return cast(dict, speech_config)
speech_config: SpeechConfig = {
"voiceConfig": {
"prebuiltVoiceConfig": {"voiceName": value["voice"]}
}
}
return cast(dict, speech_config)
else:
speech_config: SpeechConfig = {}
return cast(dict, speech_config)

def map_openai_params( # noqa: PLR0915
self,
Expand Down