Skip to content

Commit

Permalink
Merge pull request #815 from pipecat-ai/aleix/identity-filter
Browse files Browse the repository at this point in the history
processors(filters): add IdentityFilter
  • Loading branch information
aconchillo authored Dec 10, 2024
2 parents 8c9c81d + 3bf1547 commit a8644d2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### 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
during LLM function calls.

Expand Down
30 changes: 30 additions & 0 deletions src/pipecat/processors/filters/identity_filter.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit a8644d2

Please sign in to comment.