🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
only assign task_type when use_tools
lidanyang2049f6cd01c6
diff --git a/metagpt/actions/write_plan.py b/metagpt/actions/write_plan.pyindex f7c096f2c..5145ffd68 100644--- a/metagpt/actions/write_plan.py+++ b/metagpt/actions/write_plan.py@@ -53,7 +53,9 @@ class WritePlan(Action):task["task_type"] = task_typereturn json.dumps(tasks)- async def run(self, context: List[Message], max_tasks: int = 5) -> str:+ async def run(+ self, context: List[Message], max_tasks: int = 5, use_tools: bool = False+ ) -> str:prompt = (self.PROMPT_TEMPLATE.replace("__context__", "\n".join([str(ct) for ct in context]))# .replace("__current_plan__", current_plan)@@ -61,7 +63,8 @@ class WritePlan(Action):)rsp = await self._aask(prompt)rsp = CodeParser.parse_code(block=None, text=rsp)- rsp = await self.assign_task_type(json.loads(rsp))+ if use_tools:+ rsp = await self.assign_task_type(json.loads(rsp))return rsp@staticmethoddiff --git a/metagpt/roles/ml_engineer.py b/metagpt/roles/ml_engineer.pyindex 0ea73a045..8e02e093b 100644--- a/metagpt/roles/ml_engineer.py+++ b/metagpt/roles/ml_engineer.py@@ -173,7 +173,9 @@ class MLEngineer(Role):plan_confirmed = Falsewhile not plan_confirmed:context = self.get_useful_memories()- rsp = await WritePlan().run(context, max_tasks=max_tasks)+ rsp = await WritePlan().run(+ context, max_tasks=max_tasks, use_tools=self.use_tools+ )self.working_memory.add(Message(content=rsp, role="assistant", cause_by=WritePlan))