Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

Better error message printing for function call failing (#291)

Vivian Fang87fc69baaee3
diff --git a/memgpt/agent.py b/memgpt/agent.py
index 048134dc4..ecf13e86e 100644
--- a/memgpt/agent.py
+++ b/memgpt/agent.py
@@ -8,6 +8,7 @@ import os
import requests
import json
import threading
+import traceback
import openai
from memgpt.persistence_manager import LocalStateManager
@@ -568,7 +569,8 @@ class Agent(object):
function_failed = False
except Exception as e:
error_msg = f"Error calling function {function_name} with args {function_args}: {str(e)}"
- printd(error_msg)
+ error_msg_user = f"{error_msg}\n{traceback.format_exc()}"
+ printd(error_msg_user)
function_response = package_function_response(False, error_msg)
messages.append(
{
@@ -996,7 +998,8 @@ class AgentAsync(Agent):
function_failed = False
except Exception as e:
error_msg = f"Error calling function {function_name} with args {function_args}: {str(e)}"
- printd(error_msg)
+ error_msg_user = f"{error_msg}\n{traceback.format_exc()}"
+ printd(error_msg_user)
function_response = package_function_response(False, error_msg)
messages.append(
{