Sentence

class pipecat.processors.aggregators.sentence.SentenceAggregator[source]

Bases: FrameProcessor

This frame processor aggregates text frames into complete sentences.

Frame input/output:

TextFrame(“Hello,”) -> None TextFrame(” world.”) -> TextFrame(“Hello world.”)

Doctest: FIXME to work with asyncio >>> import asyncio >>> async def print_frames(aggregator, frame): … async for frame in aggregator.process_frame(frame): … print(frame.text)

>>> aggregator = SentenceAggregator()
>>> asyncio.run(print_frames(aggregator, TextFrame("Hello,")))
>>> asyncio.run(print_frames(aggregator, TextFrame(" world.")))
Hello, world.
async process_frame(frame, direction)[source]
Parameters:
  • frame (Frame)

  • direction (FrameDirection)