wake_notifier_filter
Wake notifier filter for conditional frame-based notifications.
- class pipecat.processors.filters.wake_notifier_filter.WakeNotifierFilter(notifier: BaseNotifier, *, types: tuple[type[Frame], ...], filter: Callable[[Frame], Awaitable[bool]], **kwargs)[source]
Bases:
FrameProcessorFrame processor that conditionally triggers notifications based on frame types and filters.
This processor monitors frames of specified types and executes a callback predicate when such frames are processed. If the callback returns True, the associated notifier is triggered, allowing for conditional wake-up or notification scenarios.
- __init__(notifier: BaseNotifier, *, types: tuple[type[Frame], ...], filter: Callable[[Frame], Awaitable[bool]], **kwargs)[source]
Initialize the wake notifier filter.
- Parameters:
notifier – The notifier to trigger when conditions are met.
types – Tuple of frame types to monitor for potential notifications.
filter – Async callback that determines whether to trigger notification. Should return True to trigger notification, False otherwise.
**kwargs – Additional arguments passed to parent FrameProcessor.
- async process_frame(frame: Frame, direction: FrameDirection)[source]
Process frames and conditionally trigger notifications.
- Parameters:
frame – The frame to process.
direction – The direction of frame flow in the pipeline.