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

dev: Enhance logging

Clémence Lesné78e05d24c78f
diff --git a/main.py b/main.py
index 09d2599..442eaf2 100644
--- a/main.py
+++ b/main.py
@@ -636,7 +636,7 @@ async def llm_completion(text: Optional[str], call: CallModel) -> Optional[str]:
If the system prompt is None, no completion will be run and None will be returned. Otherwise, the response of the LLM will be returned.
"""
- _logger.debug(f"Running LLM completion ({call.call_id})")
+ _logger.info(f"Running LLM completion ({call.call_id})")
if not text:
return None
@@ -713,7 +713,7 @@ async def execute_llm_chat(
user_callback: Callable[[str, MessageStyleEnum], Awaitable],
_retry_remaining: int = 3,
) -> Tuple[bool, CallModel]:
- _logger.debug(f"Running LLM chat, remaining {_retry_remaining} ({call.call_id})")
+ _logger.info(f"Running LLM chat, remaining {_retry_remaining} ({call.call_id})")
should_continue_chat = True
async def _retry() -> Tuple[bool, CallModel]:
diff --git a/models/message.py b/models/message.py
index d95df2d..b43f7b4 100644
--- a/models/message.py
+++ b/models/message.py
@@ -97,7 +97,7 @@ class ToolModel(BaseModel):
)
except json.JSONDecodeError:
logger.warn(
- f"Error decoding JSON args for function {name}: {self.function_arguments}"
+ f"Error decoding JSON args for function {name}: {self.function_arguments[:20]}...{self.function_arguments[-20:]}"
)
return f"Bad JSON format, impossible to execute function {name}"