Overview
With expressive conversation on, the LLM writes expression tags into its reply, such as<<sympathetic>> or [[laugh]], and the TTS service performs them instead of speaking them. Add Pipecat Tone’s reader, and the LLM also reads how the user sounded. This is Pipecat’s implementation of the Real-time Context Standard.
Expressive Conversation Reference
Parameters, policy, universal names, frames and events
Expressive TTS Services
The TTS services and models that perform tags
Pipecat Tone
The reader and tagger models
Examples
A bot for each supported TTS service
Prerequisites
- Pipecat 1.15.0 or later
- A TTS service and model that performs tags: see Expressive TTS Services. Any other TTS service speaks only the words.
Turn It On
Setenable_expressive_conversation=True in PipelineParams. The pipeline is an ordinary STT, LLM and TTS pipeline:
<<sympathetic>> I'm so sorry about the wait. is spoken sympathetically. Tags never reach the speech, the transcripts or the client’s text, and the conversation’s context keeps them, so the LLM sees what it wrote.
Choose What the Bot Expresses
By default, the LLM is offered Pipecat’s core names that the TTS service performs, with no guidance on when to use them. AnExpressionPolicy chooses the names and adds guidance, from presets or your own lines:
Hear How the User Sounds
Pipecat Tone’s reader reads each user turn and sets how it was meant on the transcription: the user’s emotion and how likely the turn is sarcastic. Install it:PipecatToneReader between the STT service and the user aggregator:
([emotion angry=0.81, neutral=0.12],[sarcasm value=0.04]) Where's my order?, and is taught how to read it. Say what to do with a reading in the policy’s guidance:
Let Pipecat Tone Write the Tags
Pipecat Tone’s tagger writes the tags for the LLM. The LLM is taught no tags, writes plain words, and the context keeps its replies plain. The tagger labels each sentence from the call so far and how the user sounded, in about 15 milliseconds on the CPU. AddPipecatToneTagger between the LLM and the TTS service:
Show Expression in Your App
Client apps receive expression through RTVI 2.3.0 and later:bot-output carries the delivery of the words just spoken, each sound and pause is a bot-output segment of its own, and user-input carries the reading of a transcription.
On the server, the user aggregator’s on_user_turn_stopped event carries the turn’s reading:
Use an Avatar
WithTavusTransport, the replica’s face follows the bot’s delivery, such as happiness for warm. There is nothing to set: see Avatars for the emotion each delivery shows.