rtvi_client

Frame serializer for a Pipecat pipeline acting as an RTVI client.

This is the client-side mirror of how a bot emits RTVI. It deserializes the RTVI server messages a bot sends (bot-llm-text, user-transcription, …) into pipeline frames, and serializes a client’s outgoing frames (audio, and RTVI client messages the caller builds) onto the wire. Pair it with a WebSocket client transport to let a Pipecat pipeline talk to a bot that runs an RTVI server transport (e.g. the eval transport).

It is the inverse of RTVIObserver, which turns pipeline frames into server messages on the bot side.

Note

This covers the messages a conversation needs (the LLM response lifecycle, the TTS’s spoken text, transcriptions, speaking/interruption signals, function calls). Metrics and inbound bot audio are added as the eval-simulation work progresses.

class pipecat.serializers.rtvi_client.RTVIClientSerializer(**kwargs)[source]

Bases: FrameSerializer

Bridge pipeline frames and RTVI wire messages from the client side.

__init__(**kwargs)[source]

Initialize the serializer.

Parameters:

**kwargs – Additional arguments passed to FrameSerializer.

async serialize(frame: Frame) → str | bytes | None[source]

Serialize an outgoing client frame to an RTVI wire message.

Parameters:

frame – The frame to serialize.

Returns:

JSON text for an RTVI client message, or None to drop the frame.

async deserialize(data: str | bytes) → Frame | None[source]

Deserialize an incoming RTVI server message into a pipeline frame.

Parameters:

data – JSON text (or bytes) sent by the bot.

Returns:

The corresponding frame, or None if the message is not an RTVI message or has no frame mapping yet (handled elsewhere).