From cdb0e5de0cc80942b2b365d7bec77225f2ef77e2 Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Sat, 22 Jun 2024 13:59:19 -0700 Subject: [PATCH] fix: check tool call type (#1451) --- memgpt/data_types.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/memgpt/data_types.py b/memgpt/data_types.py index 285825db..1e3dcb24 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,