TextTransformer
- class pipecat.processors.text_transformer.StatelessTextTransformer(transform_fn)[source]
Bases:
FrameProcessor
This processor calls the given function on any text in a text frame.
>>> async def print_frames(aggregator, frame): ... async for frame in aggregator.process_frame(frame): ... print(frame.text)
>>> aggregator = StatelessTextTransformer(lambda x: x.upper()) >>> asyncio.run(print_frames(aggregator, TextFrame("Hello"))) HELLO
- async process_frame(frame, direction)[source]
- Parameters:
frame (Frame)
direction (FrameDirection)