chore: Move ID generation logic out of the ORM layer and into the Pydantic model layer (#1981)

This commit is contained in:
Matthew Zhou
2024-11-05 17:05:10 -08:00
committed by GitHub
parent b9f772f196
commit b3f86fe4cd
29 changed files with 270 additions and 380 deletions

View File

@@ -3,6 +3,7 @@ import inspect
import traceback
import warnings
from abc import ABC, abstractmethod
from lib2to3.fixer_util import is_list
from typing import List, Literal, Optional, Tuple, Union
from tqdm import tqdm
@@ -250,6 +251,9 @@ class Agent(BaseAgent):
# if there are tool rules, print out a warning
warnings.warn("Tool rules only work reliably for the latest OpenAI models that support structured outputs.")
# add default rule for having send_message be a terminal tool
if not is_list(agent_state.tool_rules):
agent_state.tool_rules = []
agent_state.tool_rules.append(TerminalToolRule(tool_name="send_message"))
self.tool_rules_solver = ToolRulesSolver(tool_rules=agent_state.tool_rules)