Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
fix: Persist call model changes in tools
Clémence Lesnécd9982467068
diff --git a/app/models/message.py b/app/models/message.pyindex f31ea61..d127dfe 100644--- a/app/models/message.py+++ b/app/models/message.py@@ -15,12 +15,16 @@ from openai.types.chat import (from openai.types.chat.chat_completion_chunk import ChoiceDeltaToolCallfrom pydantic import BaseModel, Field, field_validator+from app.helpers.config import CONFIG+from app.helpers.llm_utils import AbstractPluginfrom app.helpers.monitoring import tracer_FUNC_NAME_SANITIZER_R = r"[^a-zA-Z0-9_-]"_MESSAGE_ACTION_R = r"(?:action=*([a-z_]*))? *(.*)"_MESSAGE_STYLE_R = r"(?:style=*([a-z_]*))? *(.*)"+_db = CONFIG.database.instance()+class StyleEnum(str, Enum):"""@@ -99,7 +103,7 @@ class ToolModel(BaseModel):},)- async def execute_function(self, plugin: object) -> None:+ async def execute_function(self, plugin: AbstractPlugin) -> None:from app.helpers.logging import loggerjson_str = self.function_arguments@@ -137,7 +141,13 @@ class ToolModel(BaseModel):},) as span:try:- res = await getattr(plugin, name)(**args)+ # Persist the call if updating it+ async with _db.call_transac(+ call=plugin.call,+ scheduler=plugin.scheduler,+ ):+ res = await getattr(plugin, name)(**args)+ # Format pretty logsres_log = f"{res[:20]}...{res[-20:]}"logger.info("Executing function %s (%s): %s", name, args, res_log)except TypeError as e: