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: Delete style and action from SMS

Clémence Lesnéfaee78afc5f3
diff --git a/helpers/call_events.py b/helpers/call_events.py
index 234fc98..4a316ad 100644
--- a/helpers/call_events.py
+++ b/helpers/call_events.py
@@ -16,8 +16,10 @@ from models.synthesis import SynthesisModel
from models.call import CallModel
from models.message import (
ActionEnum as MessageActionEnum,
+ extract_message_style,
MessageModel,
PersonaEnum as MessagePersonaEnum,
+ remove_message_action,
)
from helpers.call_utils import (
ContextEnum as CallContextEnum,
@@ -311,6 +313,9 @@ async def _post_call_sms(call: CallModel) -> None:
call=call,
)
+ # Delete action and style from the message as they are in the history and LLM hallucinates them
+ _, content = extract_message_style(remove_message_action(content or ""))
+
if not content:
_logger.warning("Error generating SMS report")
return