Interface StreamingSpeechModel

All Superinterfaces:
StreamingModel<SpeechPrompt,SpeechResponse>
All Known Implementing Classes:
OpenAiAudioSpeechModel
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface StreamingSpeechModel extends StreamingModel<SpeechPrompt,SpeechResponse>
The StreamingSpeechModel interface provides a way to interact with the OpenAI Text-to-Speech (TTS) API using a streaming approach, allowing you to receive the generated audio in a real-time fashion.
Since:
1.0.0-M1
Author:
Ahmed Yousri
  • Method Summary

    Modifier and Type
    Method
    Description
    default reactor.core.publisher.Flux<byte[]>
    stream(String message)
    Generates a stream of audio bytes from the provided text message.
    reactor.core.publisher.Flux<SpeechResponse>
    Sends a speech request to the OpenAI TTS API and returns a stream of the resulting speech responses.
  • Method Details

    • stream

      default reactor.core.publisher.Flux<byte[]> stream(String message)
      Generates a stream of audio bytes from the provided text message.
      Parameters:
      message - the text message to be converted to audio
      Returns:
      a Flux of audio bytes representing the generated speech
    • stream

      reactor.core.publisher.Flux<SpeechResponse> stream(SpeechPrompt prompt)
      Sends a speech request to the OpenAI TTS API and returns a stream of the resulting speech responses.
      Specified by:
      stream in interface StreamingModel<SpeechPrompt,SpeechResponse>
      Parameters:
      prompt - the speech prompt containing the input text and other parameters
      Returns:
      a Flux of speech responses, each containing a portion of the generated audio