processors(filters): add IdentityFilter
This commit is contained in:
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Added `IdentityFilter`. This is the simplest frame filter that lets through
|
||||||
|
all incoming frames.
|
||||||
|
|
||||||
- New `STTMuteStrategy` called `FUNCTION_CALL` which mutes the STT service
|
- New `STTMuteStrategy` called `FUNCTION_CALL` which mutes the STT service
|
||||||
during LLM function calls.
|
during LLM function calls.
|
||||||
|
|
||||||
|
|||||||
30
src/pipecat/processors/filters/identity_filter.py
Normal file
30
src/pipecat/processors/filters/identity_filter.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2024, Daily
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: BSD 2-Clause License
|
||||||
|
#
|
||||||
|
|
||||||
|
from pipecat.frames.frames import Frame
|
||||||
|
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||||
|
|
||||||
|
|
||||||
|
class IdentityFilter(FrameProcessor):
|
||||||
|
"""A pass-through filter that forwards all frames without modification.
|
||||||
|
|
||||||
|
This filter acts as a transparent passthrough, allowing all frames to flow
|
||||||
|
through unchanged. It can be useful when testing `ParallelPipeline` to
|
||||||
|
create pipelines that pass through frames (no frames should be repeated).
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Frame processor
|
||||||
|
#
|
||||||
|
|
||||||
|
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||||
|
"""Process an incoming frame by passing it through unchanged."""
|
||||||
|
await super().process_frame(frame, direction)
|
||||||
|
await self.push_frame(frame, direction)
|
||||||
Reference in New Issue
Block a user