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.

Fix crash from bad key access into response_message without function_call (#437)

Claudio Cambra14fbfa14060a
diff --git a/memgpt/agent.py b/memgpt/agent.py
index 24bce1ef4..0508b4dfb 100644
--- a/memgpt/agent.py
+++ b/memgpt/agent.py
@@ -424,7 +424,8 @@ class Agent(object):
printd(f"First message didn't include function call: {response_message}")
return False
- function_name = response_message["function_call"]["name"]
+ function_call = response_message.get("function_call")
+ function_name = function_call.get("name") if function_call is not None else ""
if require_send_message and function_name != "send_message" and function_name != "archival_memory_search":
printd(f"First message function call wasn't send_message or archival_memory_search: {response_message}")
return False