diff --git a/app/helpers/call_llm.py b/app/helpers/call_llm.py index cc62213..06564d7 100644 --- a/app/helpers/call_llm.py +++ b/app/helpers/call_llm.py @@ -201,8 +201,8 @@ async def _response_callback(_retry: bool = False) -> None: ) ) - # Process the response and wait for latency metrics - await _commit_answer(wait=False) + # Process the response and wait for it to be able to kill the task if needed + await _commit_answer(wait=True) # First call if len(call.messages) <= 1: @@ -215,7 +215,7 @@ async def _response_callback(_retry: bool = False) -> None: ) # User is back else: - # Welcome with the LLM, do not use the end call tool for the first message, LLM hallucinates it and this is extremely frustrating for the user + # Welcome with the LLM, do not use the end call tool for the first message, LLM hallucinates it and this is extremely frustrating for the user, don't wait for the response to start the VAD quickly await _commit_answer( tool_blacklist={"end_call"}, wait=False,