Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
fix: Never store retry errors messages in the history
Clémence Lesné3d6974ea35ca
diff --git a/helpers/call_llm.py b/helpers/call_llm.pyindex 4215a87..875da25 100644--- a/helpers/call_llm.py+++ b/helpers/call_llm.py@@ -191,15 +191,9 @@ async def load_llm_chat( # noqa: PLR0912, PLR0915if not continue_chat or _iterations_remaining < 1: # Maximum retries reachedlogger.warning("Maximum retries reached, stopping chat")content = await CONFIG.prompts.tts.error(call)- style = MessageStyleEnum.NONE- await _tts_callback(content, style)- call.messages.append(- MessageModel(- content=content,- persona=MessagePersonaEnum.ASSISTANT,- style=style,- )- )+ # Speak the error+ await _tts_callback(content, MessageStyleEnum.NONE)+ # Never store the error message in the call history, it has caused hallucinations in the LLMelse: # Retry chat after an errorlogger.info("Retrying chat, %s remaining", _iterations_remaining - 1)