Skip to content

Commit

Permalink
fix: pydantic error for tool rules (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
carenthomas authored Jan 31, 2025
1 parent 726fd64 commit 88b9c2b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions letta/orm/custom_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ def deserialize_tool_rule(data: dict) -> Union[ChildToolRule, InitToolRule, Term
"""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:
Expand Down

0 comments on commit 88b9c2b

Please sign in to comment.