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 or tts-1-hd.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', 'echo', 'fable', 'onyx', 'nova', and 'shimmer'.responseFormat
- The format to audio in. Supported formats are mp3, opus, aac, and flac. Defaults to mp3.speed
- The speed of the voice synthesis. The acceptable range is from 0.25 (slowest) to 4.0 (fastest).
- Enclosing class:
- OpenAiAudioApi
public static record OpenAiAudioApi.SpeechRequest(String model, String input, OpenAiAudioApi.SpeechRequest.Voice voice, OpenAiAudioApi.SpeechRequest.AudioResponseFormat responseFormat, Float speed)
extends Record
Request to generates audio from the input text. Reference:
Create
Speech
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The format to audio in.static class
Builder for the SpeechRequest.static enum
The voice to use for synthesis. -
Constructor Summary
ConstructorDescriptionSpeechRequest
(String model, String input, OpenAiAudioApi.SpeechRequest.Voice voice, OpenAiAudioApi.SpeechRequest.AudioResponseFormat responseFormat, Float speed) Creates an instance of aSpeechRequest
record class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.input()
Returns the value of theinput
record component.model()
Returns the value of themodel
record component.Returns the value of theresponseFormat
record component.speed()
Returns the value of thespeed
record component.final String
toString()
Returns a string representation of this record class.voice()
Returns the value of thevoice
record component.
-
Constructor Details
-
SpeechRequest
public SpeechRequest(String model, String input, OpenAiAudioApi.SpeechRequest.Voice voice, OpenAiAudioApi.SpeechRequest.AudioResponseFormat responseFormat, Float speed) Creates an instance of aSpeechRequest
record class.- Parameters:
model
- the value for themodel
record componentinput
- the value for theinput
record componentvoice
- the value for thevoice
record componentresponseFormat
- the value for theresponseFormat
record componentspeed
- the value for thespeed
record 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 themodel
record component.- Returns:
- the value of the
model
record component
-
input
Returns the value of theinput
record component.- Returns:
- the value of the
input
record component
-
voice
Returns the value of thevoice
record component.- Returns:
- the value of the
voice
record component
-
responseFormat
Returns the value of theresponseFormat
record component.- Returns:
- the value of the
responseFormat
record component
-
speed
Returns the value of thespeed
record component.- Returns:
- the value of the
speed
record component
-