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: pydantic error for tool rules (#862)

cthomas71edaadfd2cf
diff --git a/letta/orm/custom_columns.py b/letta/orm/custom_columns.py
index f821f04d6..43de03d29 100644
--- a/letta/orm/custom_columns.py
+++ b/letta/orm/custom_columns.py
@@ -85,10 +85,13 @@ class ToolRulesColumn(TypeDecorator):
"""Deserialize a dictionary to the appropriate ToolRule subclass based on the 'type'."""
rule_type = ToolRuleType(data.get("type")) # Remove 'type' field if it exists since it is a class var
if rule_type == ToolRuleType.run_first or rule_type == "InitToolRule":
+ data["type"] = ToolRuleType.run_first
return InitToolRule(**data)
elif rule_type == ToolRuleType.exit_loop or rule_type == "TerminalToolRule":
+ data["type"] = ToolRuleType.exit_loop
return TerminalToolRule(**data)
elif rule_type == ToolRuleType.constrain_child_tools or rule_type == "ToolRule":
+ data["type"] = ToolRuleType.constrain_child_tools
rule = ChildToolRule(**data)
return rule
elif rule_type == ToolRuleType.conditional: