Class SpeechGenerationOptions

java.lang.Object
com.azure.ai.openai.models.SpeechGenerationOptions
All Implemented Interfaces:
com.azure.json.JsonSerializable<SpeechGenerationOptions>

public final class SpeechGenerationOptions extends Object implements com.azure.json.JsonSerializable<SpeechGenerationOptions>
A representation of the request options that control the behavior of a text-to-speech operation.
  • Constructor Details

    • SpeechGenerationOptions

      public SpeechGenerationOptions(String input, SpeechVoice voice)
      Creates an instance of SpeechGenerationOptions class.
      Parameters:
      input - the input value to set.
      voice - the voice value to set.
  • Method Details

    • getInput

      public String getInput()
      Get the input property: The text to generate audio for. The maximum length is 4096 characters.
      Returns:
      the input value.
    • getVoice

      public SpeechVoice getVoice()
      Get the voice property: The voice to use for text-to-speech.
      Returns:
      the voice value.
    • getResponseFormat

      public SpeechGenerationResponseFormat getResponseFormat()
      Get the responseFormat property: The audio output format for the spoken text. By default, the MP3 format will be used.
      Returns:
      the responseFormat value.
    • setResponseFormat

      public SpeechGenerationOptions setResponseFormat(SpeechGenerationResponseFormat responseFormat)
      Set the responseFormat property: The audio output format for the spoken text. By default, the MP3 format will be used.
      Parameters:
      responseFormat - the responseFormat value to set.
      Returns:
      the SpeechGenerationOptions object itself.
    • getSpeed

      public Double getSpeed()
      Get the speed property: The speed of speech for generated audio. Values are valid in the range from 0.25 to 4.0, with 1.0 the default and higher values corresponding to faster speech.
      Returns:
      the speed value.
    • setSpeed

      public SpeechGenerationOptions setSpeed(Double speed)
      Set the speed property: The speed of speech for generated audio. Values are valid in the range from 0.25 to 4.0, with 1.0 the default and higher values corresponding to faster speech.
      Parameters:
      speed - the speed value to set.
      Returns:
      the SpeechGenerationOptions object itself.
    • getModel

      public String getModel()
      Get the model property: The model to use for this text-to-speech request.
      Returns:
      the model value.
    • setModel

      public SpeechGenerationOptions setModel(String model)
      Set the model property: The model to use for this text-to-speech request.
      Parameters:
      model - the model value to set.
      Returns:
      the SpeechGenerationOptions object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<SpeechGenerationOptions>
      Throws:
      IOException
    • fromJson

      public static SpeechGenerationOptions fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of SpeechGenerationOptions from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of SpeechGenerationOptions if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the SpeechGenerationOptions.