RTVIObserver translates Pipecat’s internal pipeline events into standardized RTVI protocol messages. It monitors frame flow through the pipeline and generates corresponding client messages based on event types.
Purpose
TheRTVIObserver primarily serves to convert internal pipeline frames into to client-compatible RTVI messages. It is required for any application using RTVI as the client protocol to ensure proper communication of events such as speech start/stop, user transcript, bot output, metrics, and server messages.
Adding to a Pipeline
The observer is attached to a pipeline task along with the RTVI processor:Configuration
TheRTVIObserver should be initialized with the RTVIProcessor instance along with an optional set of parameters with the following fields:
Indicates if bot output messages should be sent.
Indicates if the bot’s LLM messages should be sent.
Indicates if the bot’s TTS messages should be sent.
Indicates if the bot’s started/stopped speaking messages should be sent.
Indicates if bot’s audio level messages should be sent.
Indicates if the user’s LLM input messages should be sent.
Indicates if the user’s started/stopped speaking messages should be sent.
Indicates if user’s transcription messages should be sent.
Indicates if user’s audio level messages should be sent.
Indicates if metrics messages should be sent.
Indicates if system logs should be sent.
⚠️ Deprecated: Indicates if errors messages should be sent.
List of aggregation types to skip sending as tts/output messages.
If using this to avoid sending secure information, be sure to also disable bot_llm_enabled
to avoid leaking through LLM messages.
A list of tuples to transform text just before sending it to TTS. Each tuple should be of the form
(aggregation_type, transform_function), where aggregation_type is a string (or '*' for all types), and transform_function is a callable that takes (text, aggregation_type) and returns the transformed text.Example:How often audio levels should be sent if enabled.
Frame Translation
The observer maps Pipecat’s internal frames to RTVI protocol messages:| Pipeline Frame | RTVI Message |
|---|---|
| Speech Events | |
UserStartedSpeakingFrame | RTVIUserStartedSpeakingMessage |
UserStoppedSpeakingFrame | RTVIUserStoppedSpeakingMessage |
BotStartedSpeakingFrame | RTVIBotStartedSpeakingMessage |
BotStoppedSpeakingFrame | RTVIBotStoppedSpeakingMessage |
| Transcription | |
TranscriptionFrame | RTVIUserTranscriptionMessage(final=true) |
InterimTranscriptionFrame | RTVIUserTranscriptionMessage(final=false) |
| Bot Output | |
AggregatedTextFrame | RTVIBotOutputMessage |
| LLM Processing | |
LLMFullResponseStartFrame | RTVIBotLLMStartedMessage |
LLMFullResponseEndFrame | RTVIBotLLMStoppedMessage |
LLMTextFrame | RTVIBotLLMTextMessage |
| TTS Events | |
TTSStartedFrame | RTVIBotTTSStartedMessage |
TTSStoppedFrame | RTVIBotTTSStoppedMessage |
TTSTextFrame | RTVIBotTTSTextMessage |
| Context/Metrics | |
LLMContextFrame | RTVIUserLLMTextMessage |
MetricsFrame | RTVIMetricsMessage |
RTVIServerMessageFrame | RTVIServerMessage |