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 Details

    • Builder

      public Builder()
      Sets default values for the Request.
  • Method Details

    • chatMotor

      public MotorSpeechRequest.Builder chatMotor​(ChatMotor chatMotor)
      Sets the ChatMotor instance to be used for the request.
      Parameters:
      chatMotor - the ChatMotor instance
      Returns:
      this Builder instance for chaining
    • aiModel

      public MotorSpeechRequest.Builder aiModel​(String 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

      public MotorSpeechRequest.Builder input​(String input)
      Sets the text of the speech request.
      Parameters:
      input - the text of the speech request.
      Returns:
      this Builder instance for chaining
    • motorSpeechVoice

      public MotorSpeechRequest.Builder motorSpeechVoice​(MotorSpeechVoice motorSpeechVoice)
      Sets the voice of the speech request.
      Parameters:
      motorSpeechVoice - the voice of the speech request.
      Returns:
      this Builder instance for chaining
    • motorSpeechFormat

      public MotorSpeechRequest.Builder motorSpeechFormat​(MotorSpeechFormat 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

      public MotorSpeechRequest.Builder speechSpeed​(Double 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

      public MotorSpeechRequest.Builder inputChunkSize​(ChunkSize 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

      public MotorSpeechRequest build()
      Builds and returns a MotorSpeechRequest instance 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.