Change STTMuteProcessor to STTMuteFilter

This commit is contained in:
Mark Backman
2024-11-14 19:45:41 -05:00
parent f807f233bd
commit 966974bfc6
3 changed files with 6 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `RimeHttpTTSService` and the `07q-interruptible-rime.py` foundational - Added `RimeHttpTTSService` and the `07q-interruptible-rime.py` foundational
example. example.
- Added `STTMuteProcessor`, a general-purpose processor that combines STT - Added `STTMuteFilter`, a general-purpose processor that combines STT
muting and interruption control. When active, it prevents both transcription muting and interruption control. When active, it prevents both transcription
and interruptions during bot speech. The processor supports multiple and interruptions during bot speech. The processor supports multiple
strategies: `FIRST_SPEECH` (mute only during bot's first strategies: `FIRST_SPEECH` (mute only during bot's first

View File

@@ -21,7 +21,7 @@ from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.pipeline.task import PipelineParams, PipelineTask
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.processors.filters.stt_mute import STTMuteConfig, STTMuteProcessor, STTMuteStrategy from pipecat.processors.filters.stt_mute_filter import STTMuteConfig, STTMuteFilter, STTMuteStrategy
from pipecat.services.deepgram import DeepgramSTTService, DeepgramTTSService from pipecat.services.deepgram import DeepgramSTTService, DeepgramTTSService
from pipecat.services.openai import OpenAILLMService from pipecat.services.openai import OpenAILLMService
from pipecat.transports.services.daily import DailyParams, DailyTransport from pipecat.transports.services.daily import DailyParams, DailyTransport
@@ -50,7 +50,7 @@ async def main():
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
# Configure the mute processor to mute only during first speech # Configure the mute processor to mute only during first speech
stt_mute_processor = STTMuteProcessor( stt_mute_processor = STTMuteFilter(
stt_service=stt, config=STTMuteConfig(strategy=STTMuteStrategy.FIRST_SPEECH) stt_service=stt, config=STTMuteConfig(strategy=STTMuteStrategy.FIRST_SPEECH)
) )

View File

@@ -32,14 +32,14 @@ class STTMuteStrategy(Enum):
@dataclass @dataclass
class STTMuteConfig: class STTMuteConfig:
"""Configuration for STTMuteProcessor""" """Configuration for STTMuteFilter"""
strategy: STTMuteStrategy strategy: STTMuteStrategy
# Optional callback for custom muting logic # Optional callback for custom muting logic
should_mute_callback: Optional[Callable[["STTMuteProcessor"], Awaitable[bool]]] = None should_mute_callback: Optional[Callable[["STTMuteFilter"], Awaitable[bool]]] = None
class STTMuteProcessor(FrameProcessor): class STTMuteFilter(FrameProcessor):
"""A general-purpose processor that handles STT muting and interruption control. """A general-purpose processor that handles STT muting and interruption control.
This processor combines the concepts of STT muting and interruption control, This processor combines the concepts of STT muting and interruption control,