Class GoogleGenAiTextToSpeechModel
java.lang.Object
org.springframework.ai.google.genai.tts.GoogleGenAiTextToSpeechModel
- All Implemented Interfaces:
StreamingTextToSpeechModel,TextToSpeechModel,Model<TextToSpeechPrompt,,TextToSpeechResponse> StreamingModel<TextToSpeechPrompt,TextToSpeechResponse>
Implementation of the
TextToSpeechModel interface for Google Gemini-TTS, backed
by the Google GenAI SDK (com.google.genai).- Since:
- 2.0.2
- Author:
- Olivier Le Quellec
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionGoogleGenAiTextToSpeechModel(GoogleGenAiTextToSpeechConnectionDetails connectionDetails, GoogleGenAiAudioSpeechOptions defaultOptions) GoogleGenAiTextToSpeechModel(GoogleGenAiTextToSpeechConnectionDetails connectionDetails, GoogleGenAiAudioSpeechOptions defaultOptions, org.springframework.core.retry.RetryTemplate retryTemplate) GoogleGenAiTextToSpeechModel(GoogleGenAiTextToSpeechConnectionDetails connectionDetails, GoogleGenAiAudioSpeechOptions defaultOptions, org.springframework.core.retry.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()call(TextToSpeechPrompt prompt) Executes a method call to the AI model.Deprecated, for removal: This API element is subject to removal in a future version.Gets the options for this model.voidsetObservationConvention(@Nullable TextToSpeechModelObservationConvention observationConvention) reactor.core.publisher.Flux<TextToSpeechResponse>stream(TextToSpeechPrompt prompt) The Google GenAI SDK returns the full audio blob in a single response; true chunked streaming is not supported by the Gemini-TTS API.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.audio.tts.StreamingTextToSpeechModel
stream, streamMethods inherited from interface org.springframework.ai.audio.tts.TextToSpeechModel
call
-
Constructor Details
-
GoogleGenAiTextToSpeechModel
public GoogleGenAiTextToSpeechModel(GoogleGenAiTextToSpeechConnectionDetails connectionDetails, GoogleGenAiAudioSpeechOptions defaultOptions) -
GoogleGenAiTextToSpeechModel
public GoogleGenAiTextToSpeechModel(GoogleGenAiTextToSpeechConnectionDetails connectionDetails, GoogleGenAiAudioSpeechOptions defaultOptions, org.springframework.core.retry.RetryTemplate retryTemplate) -
GoogleGenAiTextToSpeechModel
public GoogleGenAiTextToSpeechModel(GoogleGenAiTextToSpeechConnectionDetails connectionDetails, GoogleGenAiAudioSpeechOptions defaultOptions, org.springframework.core.retry.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
builder
-
call
Description copied from interface:ModelExecutes a method call to the AI model.- Specified by:
callin interfaceModel<TextToSpeechPrompt,TextToSpeechResponse> - Specified by:
callin interfaceTextToSpeechModel- Parameters:
prompt- the request object to be sent to the AI model- Returns:
- the response from the AI model
-
setObservationConvention
public void setObservationConvention(@Nullable TextToSpeechModelObservationConvention observationConvention) -
stream
The Google GenAI SDK returns the full audio blob in a single response; true chunked streaming is not supported by the Gemini-TTS API. This method wrapscall(org.springframework.ai.audio.tts.TextToSpeechPrompt)in a single-elementFluxfor interface compatibility.- Specified by:
streamin interfaceStreamingModel<TextToSpeechPrompt,TextToSpeechResponse> - Specified by:
streamin interfaceStreamingTextToSpeechModel- Parameters:
prompt- the request object to be sent to the AI model- Returns:
- the streaming response from the AI model
-
getOptions
Description copied from interface:TextToSpeechModelGets the options for this model.- Specified by:
getOptionsin interfaceTextToSpeechModel- Returns:
- the options
-
getDefaultOptions
Deprecated, for removal: This API element is subject to removal in a future version.usegetOptions()instead.- Specified by:
getDefaultOptionsin interfaceTextToSpeechModel
-
getOptions()instead.