diff --git a/changelog/3297.deprecated.2.md b/changelog/3297.deprecated.2.md new file mode 100644 index 000000000..49d5723af --- /dev/null +++ b/changelog/3297.deprecated.2.md @@ -0,0 +1 @@ +- `FrameProcessor.interruptions_allowed` is now deprecated, use `LLMUserAggregator`'s new parameter `user_mute_strategies` instead. diff --git a/changelog/3297.deprecated.md b/changelog/3297.deprecated.md new file mode 100644 index 000000000..9ae7b8095 --- /dev/null +++ b/changelog/3297.deprecated.md @@ -0,0 +1 @@ +- `PipelineParams.allow_interruptions` is now deprecated, use `LLMUserAggregator`'s new parameter `user_mute_strategies` instead. diff --git a/examples/foundational/26f-gemini-live-files-api.py b/examples/foundational/26f-gemini-live-files-api.py index 75fda1d17..4926cecea 100644 --- a/examples/foundational/26f-gemini-live-files-api.py +++ b/examples/foundational/26f-gemini-live-files-api.py @@ -180,7 +180,6 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): task = PipelineTask( pipeline, params=PipelineParams( - allow_interruptions=True, enable_metrics=True, enable_usage_metrics=True, ), diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index f51afe38f..52b7ef896 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -951,6 +951,10 @@ class StartFrame(SystemFrame): audio_in_sample_rate: Input audio sample rate in Hz. audio_out_sample_rate: Output audio sample rate in Hz. allow_interruptions: Whether to allow user interruptions. + + .. deprecated:: 0.0.99 + Use `LLMUserAggregator`'s new `user_mute_strategies` parameter instead. + enable_metrics: Whether to enable performance metrics collection. enable_tracing: Whether to enable OpenTelemetry tracing. enable_usage_metrics: Whether to enable usage metrics collection. diff --git a/src/pipecat/pipeline/task.py b/src/pipecat/pipeline/task.py index d08f07b27..0bddf49f4 100644 --- a/src/pipecat/pipeline/task.py +++ b/src/pipecat/pipeline/task.py @@ -105,6 +105,10 @@ class PipelineParams(BaseModel): Parameters: allow_interruptions: Whether to allow pipeline interruptions. + + .. deprecated:: 0.0.99 + Use `LLMUserAggregator`'s new `user_mute_strategies` parameter instead. + audio_in_sample_rate: Input audio sample rate in Hz. audio_out_sample_rate: Output audio sample rate in Hz. enable_heartbeats: Whether to enable heartbeat monitoring. diff --git a/src/pipecat/processors/frame_processor.py b/src/pipecat/processors/frame_processor.py index a04e879e9..0a7e2751e 100644 --- a/src/pipecat/processors/frame_processor.py +++ b/src/pipecat/processors/frame_processor.py @@ -190,10 +190,11 @@ class FrameProcessor(BaseObject): self._observer: Optional[BaseObserver] = None # Other properties - self._allow_interruptions = False self._enable_metrics = False self._enable_usage_metrics = False self._report_only_initial_ttfb = False + # Other properties (deprecated) + self._allow_interruptions = False self._interruption_strategies: List[BaseInterruptionStrategy] = [] # Indicates whether we have received the StartFrame. @@ -318,9 +319,23 @@ class FrameProcessor(BaseObject): def interruptions_allowed(self): """Check if interruptions are allowed for this processor. + .. deprecated:: 0.0.99 + Use `LLMUserAggregator`'s new `user_mute_strategies` parameter instead. + Returns: True if interruptions are allowed. """ + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "`FrameProcessor.interruptions_allowed` is deprecated. " + "Use `LLMUserAggregator`'s new `user_mute_strategies` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + return self._allow_interruptions @property diff --git a/src/pipecat/services/elevenlabs/tts.py b/src/pipecat/services/elevenlabs/tts.py index d407c68ba..0a6871400 100644 --- a/src/pipecat/services/elevenlabs/tts.py +++ b/src/pipecat/services/elevenlabs/tts.py @@ -709,11 +709,10 @@ class ElevenLabsTTSService(AudioContextWordTTSService): self._partial_word = "" self._partial_word_start_time = 0.0 # If a context ID does not exist, create a new one and - # register it. If an ID exists, that means the Pipeline is - # configured for allow_interruptions=False, so continue - # using the current ID. When interruptions are enabled - # (e.g. allow_interruptions=True), user speech results in - # an interruption, which resets the context ID. + # register it. If an ID exists, that means the Pipeline + # doesn't allow user interruptions, so continue using the + # current ID. When interruptions are allowed, user speech + # results in an interruption, which resets the context ID. if not self._context_id: self._context_id = str(uuid.uuid4()) if not self.audio_context_available(self._context_id): diff --git a/src/pipecat/transports/base_output.py b/src/pipecat/transports/base_output.py index b2815b2c6..bc0eb9d6b 100644 --- a/src/pipecat/transports/base_output.py +++ b/src/pipecat/transports/base_output.py @@ -505,10 +505,12 @@ class BaseOutputTransport(FrameProcessor): await self._cancel_audio_task() await self._cancel_clock_task() await self._cancel_video_task() + # Create tasks. self._create_video_task() self._create_clock_task() self._create_audio_task() + # Let's send a bot stopped speaking if we have to. await self._bot_stopped_speaking()