Merge pull request #3297 from pipecat-ai/aleix/deprecate-allow-interruptions

deprecate allow interruptions
This commit is contained in:
Aleix Conchillo Flaqué
2025-12-28 18:50:15 -08:00
committed by GitHub
8 changed files with 32 additions and 7 deletions

View File

@@ -0,0 +1 @@
- `FrameProcessor.interruptions_allowed` is now deprecated, use `LLMUserAggregator`'s new parameter `user_mute_strategies` instead.

View File

@@ -0,0 +1 @@
- `PipelineParams.allow_interruptions` is now deprecated, use `LLMUserAggregator`'s new parameter `user_mute_strategies` instead.

View File

@@ -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,
),

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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):

View File

@@ -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()