fix: fix issue with linking tools and adding new tools (#1988)

Co-authored-by: Matt Zhou <mattzh1314@gmail.com>
This commit is contained in:
Sarah Wooders
2024-11-06 14:06:10 -08:00
committed by GitHub
parent 30c102cfd6
commit 640d4c0a22
8 changed files with 35 additions and 27 deletions

View File

@@ -3,7 +3,6 @@ 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
@@ -252,7 +251,7 @@ class Agent(BaseAgent):
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):
if agent_state.tool_rules is None:
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)