mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
only assign task_type when use_tools
This commit is contained in:
parent
e4a17d122c
commit
2049f6cd01
2 changed files with 8 additions and 3 deletions
|
|
@ -53,7 +53,9 @@ class WritePlan(Action):
|
|||
task["task_type"] = task_type
|
||||
return 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
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -173,7 +173,9 @@ class MLEngineer(Role):
|
|||
plan_confirmed = False
|
||||
while 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)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue