Class OpenAiAudioSpeechModel

java.lang.Object
org.springframework.ai.openai.OpenAiAudioSpeechModel
All Implemented Interfaces:
org.springframework.ai.audio.tts.StreamingTextToSpeechModel, org.springframework.ai.audio.tts.TextToSpeechModel, org.springframework.ai.model.Model<org.springframework.ai.audio.tts.TextToSpeechPrompt,org.springframework.ai.audio.tts.TextToSpeechResponse>, org.springframework.ai.model.StreamingModel<org.springframework.ai.audio.tts.TextToSpeechPrompt,org.springframework.ai.audio.tts.TextToSpeechResponse>

public final class OpenAiAudioSpeechModel extends Object implements org.springframework.ai.audio.tts.TextToSpeechModel
OpenAI audio speech client implementation using the OpenAI Java SDK.
Author:
Ahmed Yousri, Hyunjoon Choi, Thomas Vitale, Jonghoon Park, Ilayaperumal Gopinathan, Sebastien Deleuze, guan xu
  • Method Details

    • builder

      public static OpenAiAudioSpeechModel.Builder builder()
      Creates a new builder instance with default configuration.
      Returns:
      A new builder instance
    • mutate

      Creates a builder initialized with this model's configuration.
      Returns:
      A builder for creating a modified copy
    • call

      public byte[] call(String text)
      Specified by:
      call in interface org.springframework.ai.audio.tts.TextToSpeechModel
    • call

      public org.springframework.ai.audio.tts.TextToSpeechResponse call(org.springframework.ai.audio.tts.TextToSpeechPrompt prompt)
      Specified by:
      call in interface org.springframework.ai.model.Model<org.springframework.ai.audio.tts.TextToSpeechPrompt,org.springframework.ai.audio.tts.TextToSpeechResponse>
      Specified by:
      call in interface org.springframework.ai.audio.tts.TextToSpeechModel
    • stream

      public reactor.core.publisher.Flux<org.springframework.ai.audio.tts.TextToSpeechResponse> stream(org.springframework.ai.audio.tts.TextToSpeechPrompt prompt)
      Specified by:
      stream in interface org.springframework.ai.model.StreamingModel<org.springframework.ai.audio.tts.TextToSpeechPrompt,org.springframework.ai.audio.tts.TextToSpeechResponse>
      Specified by:
      stream in interface org.springframework.ai.audio.tts.StreamingTextToSpeechModel
    • getOptions

      public OpenAiAudioSpeechOptions getOptions()
      Specified by:
      getOptions in interface org.springframework.ai.audio.tts.TextToSpeechModel
      Since:
      2.0.0
    • getDefaultOptions

      @Deprecated(forRemoval=true) public org.springframework.ai.audio.tts.TextToSpeechOptions getDefaultOptions()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use getOptions() instead.
      Specified by:
      getDefaultOptions in interface org.springframework.ai.audio.tts.TextToSpeechModel