Skip to main content

Module rtvi

Module rtvi 

Source
Expand description

RTVI-protocol observer (pure frame→message mapping, no network).

Translates pipeline Frames into outgoing RTVI client-protocol messages (user/bot transcription, speaking edges, LLM/TTS lifecycle, function-call signalling, metrics). Mirrors pipecat’s processors/frameworks/rtvi/observer.py (RTVIObserver) and the v1 message shapes in .../rtvi/models.py.

This module is pure: it maps a frame to an RtviMessage and hands it to an injectable RtviSink. The actual transport (WebSocket/Daily/etc.) lives in the embedder; tests use the in-memory VecSink. No reqwest/network dep is pulled into flowcat-core (the networked OTel/Sentry/Langfuse exporters live in flowcat-services instead).

§What is mapped (parity with pipecat RTVIObserver.on_push_frame)

FrameRTVI message type
Frame::UserStartedSpeakinguser-started-speaking
Frame::UserStoppedSpeakinguser-stopped-speaking
Frame::BotStartedSpeakingbot-started-speaking
Frame::BotStoppedSpeakingbot-stopped-speaking
Frame::SttMuteuser-mute-started / user-mute-stopped
Frame::Transcription (user_id != "bot")user-transcription (final: true)
Frame::Transcription (user_id == "bot", realtime s2s)bot-transcription
Frame::InterimTranscription (user_id != "bot")user-transcription (final: false)
Frame::LlmResponseStartbot-llm-started
Frame::LlmResponseEndbot-llm-stopped
Frame::LlmTextbot-llm-text (+ bot-transcription on sentence end)
Frame::TtsStartedbot-tts-started
Frame::TtsStoppedbot-tts-stopped
Frame::TtsTextbot-tts-text + bot-output (spoken: true)
Frame::FunctionCallsStartedllm-function-call-started (per call)
Frame::FunctionCallInProgressllm-function-call-in-progress
Frame::FunctionCallResultllm-function-call-stopped (cancelled: false)
Frame::FunctionCallCancelllm-function-call-stopped (cancelled: true)
Frame::Metricsmetrics (bucketed ttfb/processing/tokens/characters)

Structs§

RtviMessage
One outgoing RTVI server→client message. Serializes to the exact pipecat v1 wire shape: { "label": "rtvi-ai", "type": "<type>", "data"?: { … } }.
RtviObserver
Pure frame→RTVI-message observer (PROCESSOR-DESIGN §5.1; pipecat RTVIObserver). Plugs into the pipeline Observer fan-out via FrameObserver; for each pushed frame it emits zero or more RtviMessages to the injected RtviSink.
RtviObserverParams
Toggles for which RTVI message families the observer emits. Mirrors pipecat RTVIObserverParams. All default to on (the conventional client UX), except audio levels (off — those need the audio payload + a rate limiter).
VecSink
An in-memory RtviSink that records every message — the test/inspection sink. Cheap to clone-share via Arc.

Enums§

FunctionCallReportLevel
How much function-call detail an RTVI message exposes (pipecat RTVIFunctionCallReportLevel). Defaults to None — the most secure level that still emits the event (tool-call-id only, no name/args).

Constants§

MESSAGE_LABEL
The constant label on every RTVI message (pipecat MESSAGE_LABEL).
PROTOCOL_VERSION
RTVI protocol version this observer emits (mirrors pipecat models.PROTOCOL_VERSION).

Traits§

RtviSink
Where the RtviObserver hands finished messages. Decouples the pure frame→message mapping from any transport — the live transport (WS/Daily) in the embedder implements this; tests use VecSink.