make tool ask review

This commit is contained in:
yzlin 2024-01-11 14:10:52 +08:00
parent 4ecd427bea
commit 437bbca466
6 changed files with 25 additions and 14 deletions

View file

@ -23,14 +23,15 @@ class ReviewConst:
class AskReview(Action):
async def run(self, context: List[Message], plan: Plan = None, trigger: str = "task"):
logger.info("Current overall plan:")
logger.info(
"\n".join([f"{task.task_id}: {task.instruction}, is_finished: {task.is_finished}" for task in plan.tasks])
)
async def run(self, context: List[Message] = [], plan: Plan = None, trigger: str = "task"):
if plan:
logger.info("Current overall plan:")
logger.info(
"\n".join([f"{task.task_id}: {task.instruction}, is_finished: {task.is_finished}" for task in plan.tasks])
)
logger.info("most recent context:")
latest_action = context[-1].cause_by if context[-1].cause_by else ""
latest_action = context[-1].cause_by if context and context[-1].cause_by else ""
review_instruction = (
ReviewConst.TASK_REVIEW_INSTRUCTION
if trigger == ReviewConst.TASK_REVIEW_TRIGGER

View file

@ -12,7 +12,7 @@ import yaml
from tenacity import retry, stop_after_attempt, wait_fixed
from metagpt.actions import Action
from metagpt.const import METAGPT_ROOT
from metagpt.const import METAGPT_ROOT, TOOL_SCHEMA_PATH
from metagpt.llm import LLM
from metagpt.logs import logger
from metagpt.prompts.ml_engineer import (
@ -93,7 +93,7 @@ class WriteCodeByGenerate(BaseWriteAnalysisCode):
class WriteCodeWithTools(BaseWriteAnalysisCode):
"""Write code with help of local available tools. Choose tools first, then generate code to use the tools"""
schema_path: Union[Path, str] = METAGPT_ROOT / "metagpt/tools/functions/schemas"
schema_path: Union[Path, str] = TOOL_SCHEMA_PATH
available_tools: dict = {}
def __init__(self, **kwargs):