add code_review tool to engineer2 to enhance code effectiveness

This commit is contained in:
hongjiongteng 2024-06-18 21:35:46 +08:00
parent f95a62b5df
commit 63a41ba81d
4 changed files with 105 additions and 5 deletions

View file

@ -1,5 +1,6 @@
from __future__ import annotations
from metagpt.actions.di.rewrite_code import RewriteCode
from metagpt.prompts.di.engineer2 import ENGINEER2_INSTRUCTION
from metagpt.roles.di.role_zero import RoleZero
@ -10,4 +11,14 @@ class Engineer2(RoleZero):
goal: str = "Take on game, app, and web development"
instruction: str = ENGINEER2_INSTRUCTION
tools: str = ["Plan", "Editor:write,read,write_content", "RoleZero"]
tools: str = ["Plan", "Editor:write,read,write_content", "RoleZero", "RewriteCode"]
def _update_tool_execution(self):
rewrite_code = RewriteCode()
self.tool_execution_map.update(
{
"RewriteCode.run": rewrite_code.run,
"RewriteCode": rewrite_code.run,
}
)