frames: remove StopInterruptionFrame
This commit is contained in:
@@ -20,6 +20,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Removed
|
## Removed
|
||||||
|
|
||||||
|
- Remove `StopInterruptionFrame`. This was a legacy frame that was not being
|
||||||
|
used really anywhere and it didn't provide any useful meaning. It was only
|
||||||
|
pushed after `UserStoppedSpeakingFrame`, so developers can just use
|
||||||
|
`UserStoppedSpeakingFrame`.
|
||||||
|
|
||||||
- `DailyTransport.write_dtmf()` has been removed in favor of the generic
|
- `DailyTransport.write_dtmf()` has been removed in favor of the generic
|
||||||
`BaseOutputTransport.write_dtmf()`.
|
`BaseOutputTransport.write_dtmf()`.
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ from dotenv import load_dotenv
|
|||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from pipecat.frames.frames import (
|
from pipecat.frames.frames import (
|
||||||
BotInterruptionFrame,
|
|
||||||
LLMRunFrame,
|
LLMRunFrame,
|
||||||
StopInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
UserStartedSpeakingFrame,
|
UserStartedSpeakingFrame,
|
||||||
UserStoppedSpeakingFrame,
|
UserStoppedSpeakingFrame,
|
||||||
)
|
)
|
||||||
@@ -98,11 +97,11 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
|||||||
|
|
||||||
@stt.event_handler("on_speech_started")
|
@stt.event_handler("on_speech_started")
|
||||||
async def on_speech_started(stt, *args, **kwargs):
|
async def on_speech_started(stt, *args, **kwargs):
|
||||||
await task.queue_frames([BotInterruptionFrame(), UserStartedSpeakingFrame()])
|
await task.queue_frames([StartInterruptionFrame(), UserStartedSpeakingFrame()])
|
||||||
|
|
||||||
@stt.event_handler("on_utterance_end")
|
@stt.event_handler("on_utterance_end")
|
||||||
async def on_utterance_end(stt, *args, **kwargs):
|
async def on_utterance_end(stt, *args, **kwargs):
|
||||||
await task.queue_frames([StopInterruptionFrame(), UserStoppedSpeakingFrame()])
|
await task.queue_frames([UserStoppedSpeakingFrame()])
|
||||||
|
|
||||||
@transport.event_handler("on_client_connected")
|
@transport.event_handler("on_client_connected")
|
||||||
async def on_client_connected(transport, client):
|
async def on_client_connected(transport, client):
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from pipecat.frames.frames import (
|
|||||||
LLMRunFrame,
|
LLMRunFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
SystemFrame,
|
SystemFrame,
|
||||||
TextFrame,
|
TextFrame,
|
||||||
TranscriptionFrame,
|
TranscriptionFrame,
|
||||||
@@ -234,7 +233,6 @@ class TurnDetectionLLM(Pipeline):
|
|||||||
return (
|
return (
|
||||||
isinstance(frame, OpenAILLMContextFrame)
|
isinstance(frame, OpenAILLMContextFrame)
|
||||||
or isinstance(frame, StartInterruptionFrame)
|
or isinstance(frame, StartInterruptionFrame)
|
||||||
or isinstance(frame, StopInterruptionFrame)
|
|
||||||
or isinstance(frame, FunctionCallInProgressFrame)
|
or isinstance(frame, FunctionCallInProgressFrame)
|
||||||
or isinstance(frame, FunctionCallResultFrame)
|
or isinstance(frame, FunctionCallResultFrame)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from pipecat.frames.frames import (
|
|||||||
LLMRunFrame,
|
LLMRunFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
SystemFrame,
|
SystemFrame,
|
||||||
TextFrame,
|
TextFrame,
|
||||||
TranscriptionFrame,
|
TranscriptionFrame,
|
||||||
@@ -428,7 +427,6 @@ class TurnDetectionLLM(Pipeline):
|
|||||||
return (
|
return (
|
||||||
isinstance(frame, OpenAILLMContextFrame)
|
isinstance(frame, OpenAILLMContextFrame)
|
||||||
or isinstance(frame, StartInterruptionFrame)
|
or isinstance(frame, StartInterruptionFrame)
|
||||||
or isinstance(frame, StopInterruptionFrame)
|
|
||||||
or isinstance(frame, FunctionCallInProgressFrame)
|
or isinstance(frame, FunctionCallInProgressFrame)
|
||||||
or isinstance(frame, FunctionCallResultFrame)
|
or isinstance(frame, FunctionCallResultFrame)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -869,19 +869,6 @@ class StartInterruptionFrame(SystemFrame):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class StopInterruptionFrame(SystemFrame):
|
|
||||||
"""Frame indicating user stopped speaking (interruption ended).
|
|
||||||
|
|
||||||
Emitted by the BaseInputTransport to indicate that a user has stopped
|
|
||||||
speaking (i.e. no more interruptions). This is similar to
|
|
||||||
UserStoppedSpeakingFrame except that it should be pushed concurrently
|
|
||||||
with other frames (so the order is not guaranteed).
|
|
||||||
"""
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class UserStartedSpeakingFrame(SystemFrame):
|
class UserStartedSpeakingFrame(SystemFrame):
|
||||||
"""Frame indicating user has started speaking.
|
"""Frame indicating user has started speaking.
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ from pipecat.frames.frames import (
|
|||||||
InterimTranscriptionFrame,
|
InterimTranscriptionFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
STTMuteFrame,
|
STTMuteFrame,
|
||||||
TranscriptionFrame,
|
TranscriptionFrame,
|
||||||
UserStartedSpeakingFrame,
|
UserStartedSpeakingFrame,
|
||||||
@@ -206,7 +205,6 @@ class STTMuteFilter(FrameProcessor):
|
|||||||
frame,
|
frame,
|
||||||
(
|
(
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
VADUserStartedSpeakingFrame,
|
VADUserStartedSpeakingFrame,
|
||||||
VADUserStoppedSpeakingFrame,
|
VADUserStoppedSpeakingFrame,
|
||||||
UserStartedSpeakingFrame,
|
UserStartedSpeakingFrame,
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ from pipecat.frames.frames import (
|
|||||||
FrameProcessorResumeUrgentFrame,
|
FrameProcessorResumeUrgentFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
SystemFrame,
|
SystemFrame,
|
||||||
)
|
)
|
||||||
from pipecat.metrics.metrics import LLMTokenUsage, MetricsData
|
from pipecat.metrics.metrics import LLMTokenUsage, MetricsData
|
||||||
@@ -587,8 +586,6 @@ class FrameProcessor(BaseObject):
|
|||||||
elif isinstance(frame, StartInterruptionFrame):
|
elif isinstance(frame, StartInterruptionFrame):
|
||||||
await self._start_interruption()
|
await self._start_interruption()
|
||||||
await self.stop_all_metrics()
|
await self.stop_all_metrics()
|
||||||
elif isinstance(frame, StopInterruptionFrame):
|
|
||||||
self._should_report_ttfb = True
|
|
||||||
elif isinstance(frame, CancelFrame):
|
elif isinstance(frame, CancelFrame):
|
||||||
await self.__cancel(frame)
|
await self.__cancel(frame)
|
||||||
elif isinstance(frame, (FrameProcessorPauseFrame, FrameProcessorPauseUrgentFrame)):
|
elif isinstance(frame, (FrameProcessorPauseFrame, FrameProcessorPauseUrgentFrame)):
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ from pipecat.frames.frames import (
|
|||||||
LLMUpdateSettingsFrame,
|
LLMUpdateSettingsFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
TranscriptionFrame,
|
TranscriptionFrame,
|
||||||
TTSAudioRawFrame,
|
TTSAudioRawFrame,
|
||||||
TTSStartedFrame,
|
TTSStartedFrame,
|
||||||
@@ -653,7 +652,6 @@ class OpenAIRealtimeBetaLLMService(LLMService):
|
|||||||
await self.start_ttfb_metrics()
|
await self.start_ttfb_metrics()
|
||||||
await self.start_processing_metrics()
|
await self.start_processing_metrics()
|
||||||
await self._stop_interruption()
|
await self._stop_interruption()
|
||||||
await self.push_frame(StopInterruptionFrame())
|
|
||||||
await self.push_frame(UserStoppedSpeakingFrame())
|
await self.push_frame(UserStoppedSpeakingFrame())
|
||||||
|
|
||||||
async def _maybe_handle_evt_retrieve_conversation_item_error(self, evt: events.ErrorEvent):
|
async def _maybe_handle_evt_retrieve_conversation_item_error(self, evt: events.ErrorEvent):
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ from pipecat.frames.frames import (
|
|||||||
StartFrame,
|
StartFrame,
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopFrame,
|
StopFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
SystemFrame,
|
SystemFrame,
|
||||||
UserStartedSpeakingFrame,
|
UserStartedSpeakingFrame,
|
||||||
UserStoppedSpeakingFrame,
|
UserStoppedSpeakingFrame,
|
||||||
@@ -374,7 +373,6 @@ class BaseInputTransport(FrameProcessor):
|
|||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
if self.interruptions_allowed:
|
if self.interruptions_allowed:
|
||||||
await self._stop_interruption()
|
await self._stop_interruption()
|
||||||
await self.push_frame(StopInterruptionFrame())
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Handle bot speaking state
|
# Handle bot speaking state
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ from pipecat.frames.frames import (
|
|||||||
SpriteFrame,
|
SpriteFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
StartInterruptionFrame,
|
StartInterruptionFrame,
|
||||||
StopInterruptionFrame,
|
|
||||||
SystemFrame,
|
SystemFrame,
|
||||||
TransportMessageFrame,
|
TransportMessageFrame,
|
||||||
TransportMessageUrgentFrame,
|
TransportMessageUrgentFrame,
|
||||||
@@ -273,7 +272,7 @@ class BaseOutputTransport(FrameProcessor):
|
|||||||
elif isinstance(frame, CancelFrame):
|
elif isinstance(frame, CancelFrame):
|
||||||
await self.cancel(frame)
|
await self.cancel(frame)
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
elif isinstance(frame, (StartInterruptionFrame, StopInterruptionFrame)):
|
elif isinstance(frame, StartInterruptionFrame):
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
await self._handle_frame(frame)
|
await self._handle_frame(frame)
|
||||||
elif isinstance(frame, TransportMessageUrgentFrame):
|
elif isinstance(frame, TransportMessageUrgentFrame):
|
||||||
|
|||||||
Reference in New Issue
Block a user