Class GoogleGenAiAudioSpeechOptions

java.lang.Object
org.springframework.ai.google.genai.tts.GoogleGenAiAudioSpeechOptions
All Implemented Interfaces:
TextToSpeechOptions, ModelOptions

public class GoogleGenAiAudioSpeechOptions extends Object implements TextToSpeechOptions
Options for Google Gemini-TTS text-to-speech, backed by the Google GenAI SDK (com.google.genai).

These options map to the speechConfig field of a GenerateContentConfig requested with the AUDIO response modality: model selects the Gemini-TTS model (for example gemini-2.5-flash-tts), voiceName maps to speechConfig.voiceConfig.prebuiltVoiceConfig.voiceName, replicatedVoice maps to speechConfig.voiceConfig.replicatedVoiceConfig, languageCode to speechConfig.languageCode and speakerVoiceConfigs to speechConfig.multiSpeakerVoiceConfig.speakerVoiceConfigs.

The Gemini-TTS models also accept natural-language steering: stylePrompt is prepended to the synthesized text, and multiSpeakerTurns is rendered as "Speaker: text" lines matching the speaker names of getSpeakerVoiceConfigs().

The Gemini API returns 24 kHz, 16-bit, mono PCM audio. audioEncoding only selects whether the raw PCM bytes (GoogleGenAiAudioSpeechOptions.AudioEncoding.PCM) or a WAV-wrapped version (GoogleGenAiAudioSpeechOptions.AudioEncoding.LINEAR16) are returned.

Since:
2.0.2
Author:
Olivier Le Quellec