update DA's tools

This commit is contained in:
garylin2099 2024-07-29 13:59:23 +08:00
parent 21775647b5
commit cc949edc99
2 changed files with 8 additions and 1 deletions

View file

@ -31,7 +31,7 @@ class DataAnalyst(RoleZero):
task_type_desc: str = TASK_TYPE_DESC
tools: list[str] = ["Plan", "DataAnalyst", "RoleZero", "Browser"]
custom_tools: list[str] = ["machine learning", "web scraping", "Terminal"]
custom_tools: list[str] = ["web scraping", "Terminal"]
custom_tool_recommender: ToolRecommender = None
experience_retriever: ExpRetriever = KeywordExpRetriever()
@ -72,6 +72,9 @@ class DataAnalyst(RoleZero):
Args:
instruction: The specific task description for which the code needs to be written.
"""
if self.planner.plan:
logger.info(f"Current task {self.planner.plan.current_task}")
counter = 0
success = False
await self.execute_code.init_code()

View file

@ -157,6 +157,10 @@ class ToolRecommender(BaseModel):
ranked_tools = list(ranked_tools.values())[0]
# -------------结束---------------
if not isinstance(ranked_tools, list):
logger.warning(f"Invalid rank result: {ranked_tools}, will use the recalled tools instead.")
ranked_tools = list(available_tools.keys())
valid_tools = validate_tool_names(ranked_tools)
return list(valid_tools.values())[:topk]