From 73f3d1aba4a0f529821ec3f04adad462ceccfb5f Mon Sep 17 00:00:00 2001 From: rde8026 Date: Wed, 28 Feb 2024 14:31:40 -0500 Subject: [PATCH 1/2] add trust repo to prevent failure in the future --- vocode/streaming/input_device/silero_vad.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vocode/streaming/input_device/silero_vad.py b/vocode/streaming/input_device/silero_vad.py index dbae676e7..872f94a30 100644 --- a/vocode/streaming/input_device/silero_vad.py +++ b/vocode/streaming/input_device/silero_vad.py @@ -22,7 +22,8 @@ def _load_model(self, use_onnx: bool = False) -> torch.nn.Module: repo_or_dir='silero-vad', model='silero_vad', source='local', - onnx=use_onnx + onnx=use_onnx, + trust_repo=True ) except FileNotFoundError: self.logger.warning("Could not find local VAD model, downloading from GitHub!") @@ -30,7 +31,8 @@ def _load_model(self, use_onnx: bool = False) -> torch.nn.Module: repo_or_dir='snakers4/silero-vad', model='silero_vad', source='github', - onnx=use_onnx + onnx=use_onnx, + trust_repo=True ) return model From d144f5269ad5f13c787cba3a41836791fcec1dee Mon Sep 17 00:00:00 2001 From: rde8026 Date: Thu, 29 Feb 2024 14:16:23 -0500 Subject: [PATCH 2/2] fixed reengage timing --- vocode/streaming/streaming_conversation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vocode/streaming/streaming_conversation.py b/vocode/streaming/streaming_conversation.py index 9197c0cb3..aaa00fadc 100644 --- a/vocode/streaming/streaming_conversation.py +++ b/vocode/streaming/streaming_conversation.py @@ -320,6 +320,7 @@ async def process(self, item: InterruptibleAgentResponseEvent[AgentResponse]): is_interruptible=item.is_interruptible, agent_response_tracker=item.agent_response_tracker, ) + self.conversation.mark_last_agent_response() except asyncio.CancelledError: pass @@ -385,7 +386,6 @@ async def process( await self.conversation.terminate() except asyncio.TimeoutError: pass - self.conversation.mark_last_agent_response() except asyncio.CancelledError: pass @@ -712,6 +712,7 @@ async def send_speech_to_output( "Sent chunk {} with size {}".format(chunk_idx, len(chunk_result.chunk)) ) self.mark_last_action_timestamp() + self.mark_last_agent_response() chunk_idx += 1 seconds_spoken += seconds_per_chunk if transcript_message: @@ -790,7 +791,7 @@ async def check_if_human_should_be_prompted(self): if self.last_agent_response and self.last_final_transcript_from_human: last_human_touchpoint = time.time() - self.last_final_transcript_from_human last_agent_touchpoint = time.time() - self.last_agent_response - if last_human_touchpoint >= reengage_timeout and last_agent_touchpoint >= reengage_timeout: + if (last_human_touchpoint >= reengage_timeout) and (last_agent_touchpoint >= reengage_timeout): reengage_statement = random.choice(reengage_options) self.logger.debug(f"Prompting user with {reengage_statement}: no interaction has happened in {reengage_timeout} seconds") self.chunk_size = ( @@ -812,7 +813,7 @@ async def check_if_human_should_be_prompted(self): agent_response_tracker=asyncio.Event(), ) self.mark_last_agent_response() - await asyncio.sleep(1) + await asyncio.sleep(2.5) else: await asyncio.sleep(1) self.logger.debug("stopped check if human should be prompted")