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: check tool call type (#1451)

Sarah Wooderscdb0e5de0cc8
diff --git a/memgpt/data_types.py b/memgpt/data_types.py
index 285825dbc..1e3dcb244 100644
--- a/memgpt/data_types.py
+++ b/memgpt/data_types.py
@@ -127,6 +127,8 @@ class Message(Record):
# if role == "assistant", this MAY be specified
# if role != "assistant", this must be null
assert tool_calls is None or isinstance(tool_calls, list)
+ if tool_calls is not None:
+ assert all([isinstance(tc, ToolCall) for tc in tool_calls]), f"Tool calls must be of type ToolCall, got {tool_calls}"
self.tool_calls = tool_calls
# if role == "tool", then this must be specified
@@ -751,6 +753,7 @@ class User:
class AgentState:
+
def __init__(
self,
name: str,