Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Cutted responses are properly killed and doesn't continue

Clémence Lesnéa6a39580deb4
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 load_llm_chat( # noqa: PLR0913
)
)
- # 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 load_llm_chat( # noqa: PLR0913
)
# 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,