Update VoicemailDetector to use ExternalTurnStartStrategies
This commit is contained in:
committed by
Aleix Conchillo Flaqué
parent
46db8e58d6
commit
30e6a33930
@@ -37,9 +37,13 @@ from pipecat.frames.frames import (
|
||||
)
|
||||
from pipecat.pipeline.parallel_pipeline import ParallelPipeline
|
||||
from pipecat.processors.aggregators.llm_context import LLMContext
|
||||
from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair
|
||||
from pipecat.processors.aggregators.llm_response_universal import (
|
||||
LLMContextAggregatorPair,
|
||||
LLMUserAggregatorParams,
|
||||
)
|
||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor, FrameProcessorSetup
|
||||
from pipecat.services.llm_service import LLMService
|
||||
from pipecat.turns.turn_start_strategies import ExternalTurnStartStrategies
|
||||
from pipecat.utils.sync.base_notifier import BaseNotifier
|
||||
from pipecat.utils.sync.event_notifier import EventNotifier
|
||||
|
||||
@@ -318,11 +322,13 @@ class ClassificationProcessor(FrameProcessor):
|
||||
# User started speaking - set the voicemail event
|
||||
if self._voicemail_detected:
|
||||
self._voicemail_event.set()
|
||||
await self.push_frame(frame, direction)
|
||||
|
||||
elif isinstance(frame, UserStoppedSpeakingFrame):
|
||||
# User stopped speaking - clear the voicemail event
|
||||
if self._voicemail_detected:
|
||||
self._voicemail_event.clear()
|
||||
await self.push_frame(frame, direction)
|
||||
|
||||
else:
|
||||
# Pass all non-LLM frames through
|
||||
@@ -621,7 +627,12 @@ VOICEMAIL SYSTEM (respond "VOICEMAIL"):
|
||||
|
||||
# Create the LLM context and aggregators for conversation management
|
||||
self._context = LLMContext(self._messages)
|
||||
self._context_aggregator = LLMContextAggregatorPair(self._context)
|
||||
self._context_aggregator = LLMContextAggregatorPair(
|
||||
self._context,
|
||||
user_params=LLMUserAggregatorParams(
|
||||
turn_start_strategies=ExternalTurnStartStrategies()
|
||||
),
|
||||
)
|
||||
|
||||
# Create notification system for coordinating between components
|
||||
self._gate_notifier = EventNotifier() # Signals classification completion
|
||||
|
||||
Reference in New Issue
Block a user