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

quality: Code quality

Clémence Lesnéc3f8d1bfe03a
diff --git a/helpers/config_models/prompts.py b/helpers/config_models/prompts.py
index 2212652..9a30532 100644
--- a/helpers/config_models/prompts.py
+++ b/helpers/config_models/prompts.py
@@ -292,12 +292,12 @@ class LlmModel(BaseSettings, env_prefix="prompts_llm_"):
return self._return(
self.chat_system_tpl,
- trainings=trainings,
actions=", ".join([action.value for action in MessageAction]),
bot_company=CONFIG.workflow.bot_company,
claim=_pydantic_to_str(claim),
conversation_lang=CONFIG.workflow.conversation_lang,
reminders=_pydantic_to_str(reminders),
+ trainings=trainings,
)
def sms_summary_system(
diff --git a/main.py b/main.py
index d0c8ad6..9a207f3 100644
--- a/main.py
+++ b/main.py
@@ -299,7 +299,9 @@ async def communication_event_worker(
if len(call.messages) == 1: # First call
await handle_recognize_text(
- call=call, client=client, text=CONFIG.prompts.tts.hello()
+ call=call,
+ client=client,
+ text=CONFIG.prompts.tts.hello(),
)
else: # Returning call
@@ -495,7 +497,8 @@ async def intelligence(
f"Error loading intelligence ({call.call_id}), answering with default error"
)
chat_action = ActionModel(
- content=CONFIG.prompts.tts.error(), intent=IndentAction.CONTINUE
+ content=CONFIG.prompts.tts.error(),
+ intent=IndentAction.CONTINUE,
)
_logger.debug(f"Chat ({call.call_id}): {chat_action}")
@@ -551,7 +554,10 @@ async def handle_play(
"""
if store:
call.messages.append(
- MessageModel(content=text, persona=MessagePersona.ASSISTANT)
+ MessageModel(
+ content=text,
+ persona=MessagePersona.ASSISTANT,
+ )
)
_logger.info(f"Playing text ({call.call_id}): {text}")
@@ -913,7 +919,7 @@ async def llm_chat(
# Batch remaining user return
await user_callback(buffer_content)
- # Remove tool calls from full content, if any
+ # Get data from full content to be able to store it in the DB
full_content = _remove_message_actions(full_content)
_logger.debug(f"Chat response: {full_content}")