sentence
Text sentence aggregation processor for Pipecat.
This module provides a frame processor that accumulates text frames into complete sentences, only outputting when a sentence-ending pattern is detected.
- class pipecat.processors.aggregators.sentence.SentenceAggregator[source]
Bases:
FrameProcessorAggregates text frames into complete sentences.
This processor accumulates incoming text frames until a sentence-ending pattern is detected, then outputs the complete sentence as a single frame. Useful for ensuring downstream processors receive coherent, complete sentences rather than fragmented text.
Frame input/output:
TextFrame("Hello,") -> None TextFrame(" world.") -> TextFrame("Hello, world.")
- __init__()[source]
Initialize the sentence aggregator.
Sets up internal state for accumulating text frames into complete sentences.
- async process_frame(frame: Frame, direction: FrameDirection)[source]
Process incoming frames and aggregate text into complete sentences.
- Parameters:
frame – The incoming frame to process.
direction – The direction of frame flow in the pipeline.