update engineer2 prompt

This commit is contained in:
黄伟韬 2024-09-05 20:27:20 +08:00
parent 166eb2db79
commit b8e023d8bc
2 changed files with 5 additions and 6 deletions

View file

@ -72,7 +72,7 @@ Note:
15. When provided system design or project schedule, you MUST read them first before making a plan, then adhere to them in your implementation, especially in the programming language, package, or framework. You MUST implement all code files prescribed in the system design or project schedule. You can create a plan first with each task corresponding to implementing one code file.
16. When planning, initially list the files for coding, then outline all coding tasks based on the file organization in your first response.
17. If you plan to read a file, do not include other plans in the same response.
18. Use Engineer2.write_new_code to create or modify a file. Write only one code file each time. If you only need to code one file, provide all the necessary information in one response.
18. Use Engineer2.write_new_code to create or modify a file. Write only one code file each time. Write only one code file each time and provide its full implementation.
19. When the requirement is simple, you don't need to create a plan, just do it right away.
20. If the code exists, use the Editor tool's open and edit commands to modify it. Since it is not a new code, do not use write_new_code.
21. When using the editor, pay attention to the editor's current directory. When you use editor tools, the paths must be either absolute or relative to the editor's current directory.

View file

@ -17,8 +17,7 @@ from metagpt.tools.swe_agent_commands.swe_agent_utils import load_hf_dataset
config = Config.default()
# Specify by yourself
Role = Engineer2
global_terminal = Terminal()
GLOBAL_TERMINAL = Terminal()
TEST_REPO_DIR = METAGPT_ROOT / "data" / "test_repo"
DATA_DIR = METAGPT_ROOT / "data/hugging_face"
@ -60,7 +59,7 @@ def check_instance_status(instance, swe_result_dir):
async def terminal_run_command(cmd):
cmd_output = await global_terminal.run_command(cmd)
cmd_output = await GLOBAL_TERMINAL.run_command(cmd)
logger.info(f"command:{cmd} output:\n {cmd_output}")
return cmd_output
@ -118,7 +117,7 @@ async def run(instance, swe_result_dir, args):
logger.info(f"**** Starting to run {instance['instance_id']}****")
logger.info("User Requirement", user_requirement_and_issue)
try:
role = Role(run_eval=True, editor=Editor(enable_auto_lint=True))
role = Engineer2(run_eval=True, editor=Editor(enable_auto_lint=True))
await asyncio.wait_for(role.run(user_requirement_and_issue), timeout=args.max_wait_time_per_case * 60)
except Exception as e:
print(e)
@ -156,9 +155,9 @@ async def async_main(args):
swe_result_dir.mkdir(parents=True, exist_ok=True)
for index, instance in enumerate(dataset):
# switch to a new logger file
if index < args.ignore_first_n:
continue
# switch to a new logger file
logger.remove()
logger.add(sys.stderr, level="INFO")
logger.add(swe_result_dir / "logs" / f"{index+1}_{instance['instance_id']}.log", level="DEBUG")