base_serializer
Frame serialization interfaces for Pipecat.
- class pipecat.serializers.base_serializer.FrameSerializer(params: InputParams | None = None, **kwargs)[source]
Bases:
BaseObjectAbstract base class for frame serialization implementations.
Defines the interface for converting frames to/from serialized formats for transmission or storage. Subclasses must implement the core serialize/deserialize methods.
- class InputParams(*, ignore_rtvi_messages: bool = True)[source]
Bases:
BaseModelBase configuration parameters for FrameSerializer.
- Parameters:
ignore_rtvi_messages – Whether to ignore RTVI protocol messages during serialization. Defaults to True to prevent RTVI messages from being sent to external transports.
- ignore_rtvi_messages: bool
- __init__(params: InputParams | None = None, **kwargs)[source]
Initialize the FrameSerializer.
- Parameters:
params – Configuration parameters.
**kwargs – Additional arguments passed to BaseObject (e.g., name).
- should_ignore_frame(frame: Frame) bool[source]
Check if a frame should be ignored during serialization.
This method filters out RTVI protocol messages when ignore_rtvi_messages is enabled. Subclasses can override this to add additional filtering logic.
- Parameters:
frame – The frame to check.
- Returns:
True if the frame should be ignored, False otherwise.
- async setup(frame: StartFrame)[source]
Initialize the serializer with startup configuration.
- Parameters:
frame – StartFrame containing initialization parameters.