From 1491462d157509eb336d5111a4f4a8f875e2cd90 Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Wed, 7 May 2025 11:10:54 -0400 Subject: [PATCH] [WIP] AWS Nova Sonic service - remove `_handling_bot_stopped_speaking`, which no longer seems to be necessary; I'm no longer observing back-to-back `BotStoppedSpeaking` frames --- src/pipecat/services/aws_nova_sonic/aws.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/pipecat/services/aws_nova_sonic/aws.py b/src/pipecat/services/aws_nova_sonic/aws.py index b4989185a..9f2f1f72e 100644 --- a/src/pipecat/services/aws_nova_sonic/aws.py +++ b/src/pipecat/services/aws_nova_sonic/aws.py @@ -171,7 +171,6 @@ class AWSNovaSonicLLMService(LLMService): self._assistant_is_responding = False self._context_available = False self._ready_to_send_context = False - self._handling_bot_stopped_speaking = False self._triggering_assistant_response = False self._assistant_response_trigger_audio: Optional[bytes] = ( None # Not cleared on _disconnect() @@ -248,10 +247,6 @@ class AWSNovaSonicLLMService(LLMService): await self._send_user_audio_event(frame.audio) async def _handle_bot_stopped_speaking(self): - # Protect against back-to-back BotStoppedSpeaking calls, which I've observed - if self._handling_bot_stopped_speaking: - return - self._handling_bot_stopped_speaking = True if self._assistant_is_responding: # Consider the assistant finished with their response (after a short delay, to allow for @@ -272,8 +267,6 @@ class AWSNovaSonicLLMService(LLMService): self._assistant_is_responding = False await self._report_assistant_response_ended() - self._handling_bot_stopped_speaking = False - async def _handle_function_call_result(self, frame: AWSNovaSonicFunctionCallResultFrame): result = frame.result_frame await self._send_tool_result(tool_call_id=result.tool_call_id, result=result.result) @@ -398,7 +391,6 @@ class AWSNovaSonicLLMService(LLMService): self._assistant_is_responding = False self._context_available = False self._ready_to_send_context = False - self._handling_bot_stopped_speaking = False self._triggering_assistant_response = False self._disconnecting = False self._connected_time = None