Merge branch 'mgx_ops' into add_swe_agent_ablilities_to_engineer2

This commit is contained in:
黄伟韬 2024-09-04 20:57:18 +08:00
commit 2837dc16ce
29 changed files with 751 additions and 104 deletions

View file

@ -30,8 +30,8 @@ class DataAnalyst(RoleZero):
instruction: str = ROLE_INSTRUCTION + EXTRA_INSTRUCTION
task_type_desc: str = TASK_TYPE_DESC
tools: list[str] = ["Plan", "DataAnalyst", "RoleZero", "Browser", "Editor:write,read"]
custom_tools: list[str] = ["web scraping", "Terminal"]
tools: list[str] = ["Plan", "DataAnalyst", "RoleZero", "Browser", "Editor:write,read", "SearchEnhancedQA"]
custom_tools: list[str] = ["web scraping", "Terminal", "Editor:write,read"]
custom_tool_recommender: ToolRecommender = None
experience_retriever: Annotated[ExpRetriever, Field(exclude=True)] = KeywordExpRetriever()

View file

@ -40,9 +40,10 @@ class Engineer2(RoleZero):
"Plan",
"Editor",
"RoleZero",
"Terminal",
"Terminal:run_command",
"Browser:goto,scroll",
"git_create_pull",
"SearchEnhancedQA",
"Engineer2",
]
# SWE Agent parameter

View file

@ -31,7 +31,6 @@ from metagpt.prompts.di.role_zero import (
ROLE_INSTRUCTION,
SUMMARY_PROMPT,
SYSTEM_PROMPT,
THOUGHT_GUIDANCE,
)
from metagpt.roles import Role
from metagpt.schema import AIMessage, Message, UserMessage
@ -62,7 +61,6 @@ class RoleZero(Role):
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: Optional[str] = None
@ -90,7 +88,7 @@ class RoleZero(Role):
# Others
command_rsp: str = "" # the raw string containing the commands
commands: list[dict] = [] # commands to be executed
memory_k: int = 20 # number of memories (messages) to use as historical context
memory_k: int = 100 # number of memories (messages) to use as historical context
use_fixed_sop: bool = False
requirements_constraints: str = "" # the constraints in user requirements
use_summary: bool = True # whether to summarize at the end
@ -120,6 +118,7 @@ class RoleZero(Role):
"Plan.replace_task": self.planner.plan.replace_task,
"RoleZero.ask_human": self.ask_human,
"RoleZero.reply_to_human": self.reply_to_human,
"SearchEnhancedQA.run": SearchEnhancedQA().run,
}
self.tool_execution_map.update(
{