From 81dd72bc4c62acc80817ddde21e51870783b7576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Wed, 11 Sep 2024 16:54:08 +0800 Subject: [PATCH] update prompt --- metagpt/actions/write_prd_an.py | 2 +- metagpt/prompts/di/role_zero.py | 4 ++-- metagpt/prompts/di/team_leader.py | 2 +- metagpt/roles/di/role_zero.py | 8 ++++---- metagpt/strategy/experience_retriever.py | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/metagpt/actions/write_prd_an.py b/metagpt/actions/write_prd_an.py index 12f3b1dea..f64997bd2 100644 --- a/metagpt/actions/write_prd_an.py +++ b/metagpt/actions/write_prd_an.py @@ -19,7 +19,7 @@ LANGUAGE = ActionNode( PROGRAMMING_LANGUAGE = ActionNode( key="Programming Language", expected_type=str, - instruction="Mainstream programming language, If not specified in the requirements, use HTML, CSS, and Pure JavaScript.", + instruction="Mainstream programming language. If not specified in the requirements, use HTML, CSS, and Pure JavaScript.", example="HTML, CSS, and Pure JavaScript", ) diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.py index 729a22090..3ed9389a6 100644 --- a/metagpt/prompts/di/role_zero.py +++ b/metagpt/prompts/di/role_zero.py @@ -65,7 +65,7 @@ CMD_PROMPT = ( # Current Task {current_task} -# Respond Language +# Response Language you must respond in {respond_language}. Pay close attention to the Example provided, you can reuse the example for your current situation if it fits. @@ -245,7 +245,7 @@ If you produce any deliverables, include their short descriptions and file paths If the deliverable is code, only output the file path. """ -RESPOND_LANGUAGE_DETECT = """ +DETECT_LANGUAGE_PROMPT = """ The requirement is: {requirement} diff --git a/metagpt/prompts/di/team_leader.py b/metagpt/prompts/di/team_leader.py index d5bf6cb72..139021ae1 100644 --- a/metagpt/prompts/di/team_leader.py +++ b/metagpt/prompts/di/team_leader.py @@ -32,7 +32,7 @@ Note: 9. Do not use the 'end' command when the current task remains unfinished; instead, use the 'finish_current_task' command to indicate completion before switching to the next task. 10. Do not use escape characters in json data, particularly within file paths. 11. Analyze the capabilities of team members and assign tasks to them based on user Requirements. If the requirements ask to ignore certain tasks, follow the requirements. -12. If the the user message is a question. use 'reply to human' to respond to the question, and then end. +12. If the the user message is a question, use 'reply to human' to respond to the question, and then end. 13. Instructions and reply must be in the same language. 14. Default technology stack is HTML (.html), CSS (.css), and Pure JavaScript (.js). Web app is the default option when developing software. 15. You are the only one who decides the programming language for the software, so the instruction must contain the programming language. diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.py index 6e5618faa..71e0ab426 100644 --- a/metagpt/roles/di/role_zero.py +++ b/metagpt/roles/di/role_zero.py @@ -20,6 +20,7 @@ from metagpt.logs import logger from metagpt.prompts.di.role_zero import ( ASK_HUMAN_COMMAND, CMD_PROMPT, + DETECT_LANGUAGE_PROMPT, JSON_REPAIR_PROMPT, QUICK_RESPONSE_SYSTEM_PROMPT, QUICK_THINK_EXAMPLES, @@ -27,7 +28,6 @@ from metagpt.prompts.di.role_zero import ( QUICK_THINK_SYSTEM_PROMPT, REGENERATE_PROMPT, REPORT_TO_HUMAN_PROMPT, - RESPOND_LANGUAGE_DETECT, ROLE_INSTRUCTION, SUMMARY_PROMPT, SYSTEM_PROMPT, @@ -92,7 +92,7 @@ class RoleZero(Role): commands: list[dict] = [] # commands to be executed memory_k: int = 200 # number of memories (messages) to use as historical context use_fixed_sop: bool = False - respond_language: str = "" # the constraints of respond language + respond_language: str = "" # Language for responding humans and publishing messages. use_summary: bool = True # whether to summarize at the end @model_validator(mode="after") @@ -179,8 +179,8 @@ class RoleZero(Role): if not self.planner.plan.goal: self.planner.plan.goal = self.get_memories()[-1].content - repond_language_detect = RESPOND_LANGUAGE_DETECT.format(requirement=self.planner.plan.goal) - self.respond_language = await self.llm.aask(repond_language_detect) + detect_language_prompt = DETECT_LANGUAGE_PROMPT.format(requirement=self.planner.plan.goal) + self.respond_language = await self.llm.aask(detect_language_prompt) ### 1. Experience ### example = self._retrieve_experience() diff --git a/metagpt/strategy/experience_retriever.py b/metagpt/strategy/experience_retriever.py index 38e3a6a16..0f51f60db 100644 --- a/metagpt/strategy/experience_retriever.py +++ b/metagpt/strategy/experience_retriever.py @@ -479,7 +479,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "1", "dependent_task_ids": [], - "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. And create a product requirement document (PRD) outlining the features, user interface. ", + "instruction": "Use HTML, CSS, Pure JavaScrip as the programming language. And create a product requirement document (PRD) outlining the features, user interface. ", "assignee": "Alice" } }, @@ -488,7 +488,7 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "2", "dependent_task_ids": ["1"], - "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.", + "instruction": "Use HTML, CSS, Pure JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.", "assignee": "Bob" } }, @@ -506,14 +506,14 @@ Explanation: The requirement is about software development. Assign each tasks to "args": { "task_id": "4", "dependent_task_ids": ["3"], - "instruction": "Using HTML, CSS, Pure JavaScrip as the programming language. Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking.", + "instruction": "Use HTML, CSS, Pure JavaScrip as the programming language. Implement the core game logic for the CLI snake game, including snake movement, food generation, and score tracking.", "assignee": "Alex" } }, { "command_name": "TeamLeader.publish_message", "args": { - "content": "Using HTML, CSS, Pure JavaScrip as the programming language. Create a cli snake game.", + "content": "Use HTML, CSS, Pure JavaScrip as the programming language. Create a cli snake game.", "send_to": "Alice" } },