Skip to content

Commit

Permalink
Better error message printing for function call failing (#291)
Browse files Browse the repository at this point in the history
* Better error message printing for function call failing

* only one import traceback

* don't forward entire stack trace to memgpt
  • Loading branch information
vivi authored Nov 6, 2023
1 parent 236f3db commit 8202c0f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions memgpt/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import requests
import json
import threading
import traceback

import openai
from memgpt.persistence_manager import LocalStateManager
Expand Down Expand Up @@ -568,7 +569,8 @@ def handle_ai_response(self, response_message):
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(
{
Expand Down Expand Up @@ -996,7 +998,8 @@ async def handle_ai_response(self, response_message):
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(
{
Expand Down

0 comments on commit 8202c0f

Please sign in to comment.