tts pipeline hook
gives you the reply’s text stream so you can transform it before synthesis.
The tts hook
Register an async hook with @pipeline.on("tts"). It receives the streaming reply
text; yield the transformed text, then hand it to run_tts() to produce the audio.
What you can do in the hook
- Fix pronunciation of acronyms, brand names, and technical terms (shown above).
- Filter or redact content before it’s spoken.
- Normalize formatting: strip markdown, expand numbers/dates, clean up symbols.
References
- Python
Examples
Enhanced Pronunciation
Rewrite text before synthesis.