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

doc: Make clearer the comments about some business exceptions

Clémence Lesnéad7a8b6571c5
diff --git a/helpers/call_events.py b/helpers/call_events.py
index 309f1fc..a7ac124 100644
--- a/helpers/call_events.py
+++ b/helpers/call_events.py
@@ -207,11 +207,12 @@ async def on_recognize_timeout_error(
call.recognition_retry,
CONFIG.conversation.voice_recognition_retry_max,
)
+ # Never store the warning message in the call history, it has caused hallucinations in the LLM
await handle_recognize_text(
call=call,
client=client,
no_response_error=True,
- store=False, # Do not store timeout prompt as it perturbs the LLM and makes it hallucinate
+ store=False,
text=await CONFIG.prompts.tts.timeout_silence(call),
)
@@ -246,11 +247,12 @@ async def on_recognize_unknown_error(
error_code,
)
+ # Never store the error message in the call history, it has caused hallucinations in the LLM
await handle_recognize_text(
call=call,
client=client,
no_response_error=True,
- store=False, # Do not store error prompt as it perturbs the LLM and makes it hallucinate
+ store=False,
text=await CONFIG.prompts.tts.error(call),
)
diff --git a/helpers/call_llm.py b/helpers/call_llm.py
index a142db4..4215a87 100644
--- a/helpers/call_llm.py
+++ b/helpers/call_llm.py
@@ -165,10 +165,11 @@ async def load_llm_chat( # noqa: PLR0912, PLR0915
CONFIG.conversation.answer_soft_timeout_sec,
)
soft_timeout_triggered = True
+ # Never store the error message in the call history, it has caused hallucinations in the LLM
await handle_recognize_text(
call=call,
client=client,
- store=False, # Do not store timeout prompt as it perturbs the LLM and makes it hallucinate
+ store=False,
text=await CONFIG.prompts.tts.timeout_loading(call),
)