Package com.chatmotorapi.api.speech
Class MotorSpeechRequest.Builder
java.lang.Object
com.chatmotorapi.api.speech.MotorSpeechRequest.Builder
- Enclosing class:
- MotorSpeechRequest
public static class MotorSpeechRequest.Builder extends Object
Builder class for creating a MotorSpeechRequest instance.
-
Constructor Summary
Constructors Constructor Description Builder()Sets default values for the Request. -
Method Summary
Modifier and Type Method Description MotorSpeechRequest.BuilderaiModel(String aiModel)Sets the OpenAI model to use for the requestMotorSpeechRequestbuild()Builds and returns aMotorSpeechRequestinstance based on the set parameters.MotorSpeechRequest.BuilderchatMotor(ChatMotor chatMotor)Sets the ChatMotor instance to be used for the request.MotorSpeechRequest.Builderinput(String input)Sets the text of the speech request.MotorSpeechRequest.BuilderinputChunkSize(ChunkSize inputChunkSize)Sets the input chunk size.MotorSpeechRequest.BuildermotorSpeechFormat(MotorSpeechFormat motorSpeechFormat)Sets the response format of the speech request.MotorSpeechRequest.BuildermotorSpeechVoice(MotorSpeechVoice motorSpeechVoice)Sets the voice of the speech request.MotorSpeechRequest.BuilderspeechSpeed(Double speechSpeed)Sets the speed of the speech request.
-
Constructor Details
-
Builder
public Builder()Sets default values for the Request.
-
-
Method Details
-
chatMotor
Sets the ChatMotor instance to be used for the request.- Parameters:
chatMotor- the ChatMotor instance- Returns:
- this Builder instance for chaining
-
aiModel
Sets the OpenAI model to use for the request- Parameters:
aiModel- the model identifier, e.g., "gpt-4-turbo-preview"- Returns:
- this Builder instance for chaining
-
input
Sets the text of the speech request.- Parameters:
input- the text of the speech request.- Returns:
- this Builder instance for chaining
-
motorSpeechVoice
Sets the voice of the speech request.- Parameters:
motorSpeechVoice- the voice of the speech request.- Returns:
- this Builder instance for chaining
-
motorSpeechFormat
Sets the response format of the speech request. Default is MP3 if not specified.- Parameters:
motorSpeechFormat- the response format of the speech request.- Returns:
- this Builder instance for chaining
-
speechSpeed
Sets the speed of the speech request. Default is 1.0 if not specified.- Parameters:
speechSpeed- the speed of the speech request.- Returns:
- this Builder instance for chaining
-
inputChunkSize
Sets the input chunk size.Note: This method is generally not recommended for use. The default chunk size defined in
ChatMotor.maxChunkInputSize()is used.- Parameters:
inputChunkSize- the input chunk size- Returns:
- this builder instance for chaining
-
build
Builds and returns aMotorSpeechRequestinstance based on the set parameters.- Returns:
- a new
MotorSpeechRequest - Throws:
IllegalArgumentException- if the chatMotor is not provided.IllegalArgumentException- if the input is not provided.IllegalArgumentException- if the motorSpeechVoice is not provided.
-