合并teamleader 和sweagent的原系统提示词

This commit is contained in:
黄伟韬 2024-08-09 19:51:00 +08:00
parent f338d168ca
commit d788722bc2
4 changed files with 14 additions and 4 deletions

View file

@ -48,6 +48,8 @@ Special Command: Use {{"command_name": "end"}} to do nothing or indicate complet
"""
CMD_PROMPT = """
{current_state}
# Current Plan
{plan_status}

View file

@ -233,10 +233,12 @@ These examples are provided to demonstrate the output style that expected to be
# IMPORTANT TIPS
{IMPORTANT_TIPS}
Avoid repeating the same command. Instead, please think about the current situation and provide the next bash command to execute in JSON format:"
"""
CURRENT_BASH_STATE = """
# Output Next Step
The current bash state is:
(Open file: {{open_file}})
(Current directory: {{working_dir}})
Avoid repeating the same command. Instead, please think about the current situation and provide the next bash command to execute in JSON format:"
"""

View file

@ -49,6 +49,7 @@ class RoleZero(Role):
goal: str = ""
system_prompt: str = SYSTEM_PROMPT # Use None to conform to the default value at llm.aask
cmd_prompt: str = CMD_PROMPT
cmd_prompt_current_state: str = ""
thought_guidance: str = THOUGHT_GUIDANCE
instruction: str = ROLE_INSTRUCTION
task_type_desc: str = None
@ -161,6 +162,7 @@ class RoleZero(Role):
### Make Decision Dynamically ###
prompt = self.cmd_prompt.format(
current_state=self.cmd_prompt_current_state,
plan_status=plan_status,
current_task=current_task,
requirements_constraints=self.requirements_constraints,

View file

@ -3,7 +3,11 @@ import json
from pydantic import Field
from metagpt.logs import logger
from metagpt.prompts.di.swe_agent import MINIMAL_EXAMPLE, NEXT_STEP_TEMPLATE
from metagpt.prompts.di.swe_agent import (
CURRENT_BASH_STATE,
MINIMAL_EXAMPLE,
NEXT_STEP_TEMPLATE,
)
from metagpt.roles.di.role_zero import RoleZero
from metagpt.tools.libs.git import git_create_pull
from metagpt.tools.libs.terminal import Bash
@ -49,7 +53,7 @@ class SWEAgent(RoleZero):
"""
state_output = await self.terminal.run("state")
bash_state = json.loads(state_output)
self.instruction = self._instruction.format(**bash_state).strip()
self.cmd_prompt_current_state = CURRENT_BASH_STATE.formate(**bash_state).strip()
async def _parse_commands_for_eval(self):
"""