Record Class OpenAiAudioApi.SpeechRequest
java.lang.Object
java.lang.Record
org.springframework.ai.openai.api.OpenAiAudioApi.SpeechRequest
- Record Components:
model- The model to use for generating the audio. One of the available TTS models: tts-1, tts-1-hd, or gpt-4o-mini-tts.input- The input text to synthesize. Must be at most 4096 tokens long.voice- The voice to use for synthesis. One of the available voices for the chosen model: 'alloy', 'ash', 'ballad', 'coral', 'echo', 'fable', 'onyx', 'nova', 'sage', 'shimmer', and 'verse'.responseFormat- The format to audio in. Supported formats are mp3, opus, aac, flac, wav, and pcm. Defaults to mp3.speed- The speed of the voice synthesis. The acceptable range is from 0.25 (slowest) to 4.0 (fastest). Does not work with gpt-4o-mini-tts.
- Enclosing class:
- OpenAiAudioApi
public static record OpenAiAudioApi.SpeechRequest(String model, String input, String voice, OpenAiAudioApi.SpeechRequest.AudioResponseFormat responseFormat, Double speed)
extends Record
Request to generates audio from the input text. Reference:
Create
Speech
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe format to audio in.static final classBuilder for the SpeechRequest.static enumThe voice to use for synthesis. -
Constructor Summary
ConstructorsConstructorDescriptionSpeechRequest(String model, String input, String voice, OpenAiAudioApi.SpeechRequest.AudioResponseFormat responseFormat, Double speed) Creates an instance of aSpeechRequestrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.input()Returns the value of theinputrecord component.model()Returns the value of themodelrecord component.Returns the value of theresponseFormatrecord component.speed()Returns the value of thespeedrecord component.final StringtoString()Returns a string representation of this record class.voice()Returns the value of thevoicerecord component.
-
Constructor Details
-
SpeechRequest
public SpeechRequest(String model, String input, String voice, OpenAiAudioApi.SpeechRequest.AudioResponseFormat responseFormat, Double speed) Creates an instance of aSpeechRequestrecord class.- Parameters:
model- the value for themodelrecord componentinput- the value for theinputrecord componentvoice- the value for thevoicerecord componentresponseFormat- the value for theresponseFormatrecord componentspeed- the value for thespeedrecord component
-
-
Method Details
-
builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
model
Returns the value of themodelrecord component.- Returns:
- the value of the
modelrecord component
-
input
Returns the value of theinputrecord component.- Returns:
- the value of the
inputrecord component
-
voice
Returns the value of thevoicerecord component.- Returns:
- the value of the
voicerecord component
-
responseFormat
Returns the value of theresponseFormatrecord component.- Returns:
- the value of the
responseFormatrecord component
-
speed
Returns the value of thespeedrecord component.- Returns:
- the value of the
speedrecord component
-