async_generator

Async generator processor for frame serialization and streaming.

class pipecat.processors.async_generator.AsyncGeneratorProcessor(*, serializer: FrameSerializer, **kwargs)[source]

Bases: FrameProcessor

A frame processor that serializes frames and provides them via async generator.

This processor passes frames through unchanged while simultaneously serializing them and making the serialized data available through an async generator interface. Useful for streaming frame data to external consumers while maintaining the normal frame processing pipeline.

__init__(*, serializer: FrameSerializer, **kwargs)[source]

Initialize the async generator processor.

Parameters:
  • serializer – The frame serializer to use for converting frames to data.

  • **kwargs – Additional arguments passed to the parent FrameProcessor.

async process_frame(frame: Frame, direction: FrameDirection)[source]

Process frames by passing them through and queuing serialized data.

Parameters:
  • frame – The frame to process.

  • direction – The direction of frame flow in the pipeline.

async generator() AsyncGenerator[Any, None][source]

Generate serialized frame data asynchronously.

Yields:

Serialized frame data from the internal queue until a termination signal (None) is received.