Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Elevenlabs Elevenlabs python Text Source Preparation

From Leeroopedia
Revision as of 18:15, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/Elevenlabs_Elevenlabs_python_Text_Source_Preparation.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Streaming, Data_Preparation
Last Updated 2026-02-15 00:00 GMT

Overview

A user-defined pattern for creating a Python iterator that yields text fragments for consumption by the realtime text-to-speech streaming API.

Description

Text Source Preparation is the pattern of creating a Python generator or iterator that yields text strings for realtime TTS. This is not a library API but a user-implemented interface. The text source can be any generator: LLM streaming output, file reader, user keyboard input, or any other progressive text source.

The iterator must yield str values. The text_chunker utility will buffer these fragments at sentence boundaries before they are sent to the WebSocket API.

Usage

Implement this pattern whenever using convert_realtime. The text source is the text parameter.

Theoretical Basis

# Interface specification
def text_source() -> Iterator[str]:
    """Yield text fragments for realtime TTS."""
    yield "fragment1"
    yield "fragment2"
    ...

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment