Interface StreamingInputTextToSpeechModel

All Known Implementing Classes:
DashScopeAudioSpeechModel

public interface StreamingInputTextToSpeechModel
Interface for TTS models that support streaming text input.

Unlike TextToSpeechModel which accepts complete text upfront, this interface allows text to be sent incrementally (e.g., as it becomes available from LLM streaming output), enabling lower latency for models like CosyVoice and Qwen TTS Realtime.

Author:
spring-ai-alibaba
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Flux<org.springframework.ai.audio.tts.TextToSpeechResponse>
    stream(reactor.core.publisher.Flux<String> textStream, org.springframework.ai.audio.tts.TextToSpeechOptions options)
    Stream text-to-speech with streaming text input.
  • Method Details

    • stream

      reactor.core.publisher.Flux<org.springframework.ai.audio.tts.TextToSpeechResponse> stream(reactor.core.publisher.Flux<String> textStream, org.springframework.ai.audio.tts.TextToSpeechOptions options)
      Stream text-to-speech with streaming text input.
      Parameters:
      textStream - the text stream to be synthesized (e.g., from LLM streaming output)
      options - TTS options including model, voice, etc.
      Returns:
      flux of audio responses (each typically contains a chunk of audio data)