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:
BaseModelWhat one eval connection asks of the bot, sent in the
eval-connectmessage.- 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-connectmessage carryingflags, as JSON text.
- pipecat.evals.serializer.parse_eval_connect(message: Any) EvalConnectionFlags | None[source]
The flags of an
eval-connectmessage, orNonefor any other message.- Parameters:
message – A decoded JSON message.
- class pipecat.evals.serializer.EvalSerializer(**kwargs)[source]
Bases:
FrameSerializerBridges RTVI messages and frames on the bot’s side of an eval.
The serializer of
EvalTransport;EvalClientSerializeris the harness’s end. The bot pipeline needs anRTVIProcessorand anRTVIObserver.- __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, orNoneif 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
Noneto 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
LLMMessagesUpdateFramefor the eval-context control message, anInputTransportMessageFramewrapping any other RTVI message, orNoneif the payload is not a valid RTVI message.
- class pipecat.evals.serializer.RTVIEvalSerializer(**kwargs)[source]
Bases:
EvalSerializerDeprecated alias for
EvalSerializer.Deprecated since version 1.9.0: Use
EvalSerializerinstead. Will be removed in 2.0.0.
- class pipecat.evals.serializer.EvalClientSerializer(**kwargs)[source]
Bases:
RTVIClientSerializerThe harness’s serializer: RTVI client messages, plus the eval’s own.
eval-bot-audiobecomes anInputAudioRawFrameso 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 doeseval-bot-image, which has no frame on the harness’s side to become. The deprecateduser-transcriptionis dropped:user-inputcarries the same transcriptions.