formatting

This commit is contained in:
yzlin 2024-01-11 14:15:33 +08:00
parent 437bbca466
commit 17aeb9f825
4 changed files with 11 additions and 5 deletions

View file

@ -27,7 +27,9 @@ class AskReview(Action):
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])
"\n".join(
[f"{task.task_id}: {task.instruction}, is_finished: {task.is_finished}" for task in plan.tasks]
)
)
logger.info("most recent context:")

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, TOOL_SCHEMA_PATH
from metagpt.const import TOOL_SCHEMA_PATH
from metagpt.llm import LLM
from metagpt.logs import logger
from metagpt.prompts.ml_engineer import (

View file

@ -28,7 +28,9 @@ class CodeInterpreter(Role):
make_udfs=False,
**kwargs,
):
super().__init__(name=name, profile=profile, goal=goal, auto_run=auto_run, use_tools=use_tools, make_udfs=make_udfs, **kwargs)
super().__init__(
name=name, profile=profile, goal=goal, auto_run=auto_run, use_tools=use_tools, make_udfs=make_udfs, **kwargs
)
self._set_react_mode(react_mode="plan_and_act", auto_run=auto_run, use_tools=use_tools)
@property
@ -97,4 +99,6 @@ class CodeInterpreter(Role):
logger.info("Plan completed. Now start to make tools ...")
tool_maker = ToolMaker()
for task in self.planner.plan.get_finished_tasks():
await tool_maker.make_tool(code=task.code, instruction=task.instruction, task_id=task.task_id, auto_run=self.auto_run)
await tool_maker.make_tool(
code=task.code, instruction=task.instruction, task_id=task.task_id, auto_run=self.auto_run
)

View file

@ -45,7 +45,7 @@ class ToolMaker(Role):
_, confirmed = await self.ask_review(auto_run=auto_run)
if confirmed:
make_tools.save(tool_code)
async def ask_review(self, auto_run: bool = True):
if not auto_run:
review, confirmed = await AskReview().run()