serializer

The two ends of the eval wire.

EvalSerializer runs in the bot, as the serializer of its EvalTransport; EvalClientSerializer runs in the harness, in EvalClientTransport. Both speak RTVI. The eval adds messages of its own on top: eval-connect, eval-configure, eval-context, eval-cancel, and eval-image from the harness, and eval-bot-audio and eval-bot-image from the bot when the harness asks for them.

class pipecat.evals.serializer.EvalConnectionFlags(*, skip_tts: bool = False, capture_bot_audio: bool = False, capture_bot_images: bool = False)[source]

Bases: BaseModel

What one eval connection asks of the bot, sent in the eval-connect message.

Parameters:
  • skip_tts – Silence the bot’s speech for the connection (text mode).

  • capture_bot_audio – Forward the bot’s synthesized audio to the harness.

  • capture_bot_images – Report the images the bot outputs to the harness.

pipecat.evals.serializer.eval_connect_message(flags: EvalConnectionFlags) → str[source]

The eval-connect message carrying flags, as JSON text.

pipecat.evals.serializer.parse_eval_connect(message: Any) → EvalConnectionFlags | None[source]

The flags of an eval-connect message, or None for any other message.

Parameters:

message – A decoded JSON message.

class pipecat.evals.serializer.EvalSerializer(**kwargs)[source]

Bases: FrameSerializer

Bridges RTVI messages and frames on the bot’s side of an eval.

The serializer of EvalTransport; EvalClientSerializer is the harness’s end. The bot pipeline needs an RTVIProcessor and an RTVIObserver.

__init__(**kwargs)[source]

Initialize the serializer.

Parameters:

**kwargs – Additional arguments passed to FrameSerializer.

set_capture_audio(capture: bool) → None[source]

Enable/disable forwarding the bot’s synthesized audio to the harness.

set_capture_images(capture: bool) → None[source]

Enable/disable reporting the images the bot outputs to the harness.

get_user_image() → tuple[bytes, str] | None[source]

The image registered for the current turn as (bytes, mime), or None.

async user_image_frame(request: UserImageRequestFrame) → UserImageRawFrame | None[source]

The registered image as the frame answering request, or None if none is registered.

The harness sends the image encoded, but a real camera transport pushes raw frames, so it is decoded to raw RGB. The LLM context re-encodes raw frames to JPEG anyway, and consumers that decode directly (e.g. a local vision model doing Image.frombytes) need the raw pixels and real size.

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

Serialize an outbound frame for the harness; only RTVI server messages go out.

Parameters:

frame – The frame to serialize.

Returns:

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

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

Deserialize an inbound JSON RTVI message into a frame.

Parameters:

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

Returns:

An LLMMessagesUpdateFrame for the eval-context control message, an InputTransportMessageFrame wrapping any other RTVI message, or None if the payload is not a valid RTVI message.

class pipecat.evals.serializer.RTVIEvalSerializer(**kwargs)[source]

Bases: EvalSerializer

Deprecated alias for EvalSerializer.

Deprecated since version 1.9.0: Use EvalSerializer instead. Will be removed in 2.0.0.

class pipecat.evals.serializer.EvalClientSerializer(**kwargs)[source]

Bases: RTVIClientSerializer

The harness’s serializer: RTVI client messages, plus the eval’s own.

eval-bot-audio becomes an InputAudioRawFrame so the harness’s STT can transcribe what the bot actually said. The bot’s reports about the harness (its transcription, VAD, and speaking messages) stay raw messages rather than becoming frames, so they cannot be mistaken for what the harness computes from the bot’s audio. So does eval-bot-image, which has no frame on the harness’s side to become. The deprecated user-transcription is dropped: user-input carries the same transcriptions.

__init__(**kwargs)[source]

Initialize the serializer.

Parameters:

**kwargs – Additional arguments passed to RTVIClientSerializer.

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

Deserialize an RTVI server message, handling the eval-specific types.

Parameters:

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

Returns:

The corresponding frame, or None to drop the message.