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: Tool new_claim create a new claim

Clémence Lesnéae051c18c9f6
diff --git a/helpers/call_llm.py b/helpers/call_llm.py
index cea8915..a5141d3 100644
--- a/helpers/call_llm.py
+++ b/helpers/call_llm.py
@@ -419,6 +419,7 @@ async def _execute_llm_chat(
# Execute tools
tool_tasks = [tool_call.execute_function(plugins) for tool_call in tool_calls]
await asyncio.gather(*tool_tasks)
+ call = plugins.call # Update call model if object reference changed
# Store message
call.messages.append(
diff --git a/helpers/llm_tools.py b/helpers/llm_tools.py
index 406d1f8..e383690 100644
--- a/helpers/llm_tools.py
+++ b/helpers/llm_tools.py
@@ -99,8 +99,19 @@ class LlmPlugins:
self.post_call_intelligence(self.call)
# Store the last message and use it at first message of the new claim
last_message = self.call.messages[-1]
- call = CallStateModel(phone_number=self.call.phone_number)
- call.messages.append(last_message)
+ call = CallStateModel(
+ phone_number=self.call.phone_number,
+ voice_id=self.call.voice_id,
+ )
+ call.messages += [
+ MessageModel(
+ action=MessageActionEnum.CALL,
+ content="",
+ persona=MessagePersonaEnum.HUMAN,
+ ),
+ last_message,
+ ]
+ self.call = call
return "Claim, reminders and messages reset"
async def new_or_updated_reminder(