mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
remove requirements_constraints
This commit is contained in:
parent
a34394e66f
commit
6365995f71
5 changed files with 46 additions and 19 deletions
|
|
@ -44,11 +44,9 @@ Special Command: Use {{"command_name": "end"}} to do nothing or indicate complet
|
|||
# Example
|
||||
{example}
|
||||
|
||||
# Role Instruction
|
||||
# Instruction
|
||||
{instruction}
|
||||
|
||||
# Common Instruction
|
||||
1. Choose a language the user can understand for responding. Usually, use the same as the user's message.
|
||||
"""
|
||||
|
||||
CMD_EXPERIENCE_MASK = f"""
|
||||
|
|
@ -67,8 +65,8 @@ CMD_PROMPT = (
|
|||
# Current Task
|
||||
{current_task}
|
||||
|
||||
# Restrictions
|
||||
{requirements_constraints}
|
||||
# Respond 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.
|
||||
You may use any of the available commands to create a plan or update the plan. You may output mutiple commands, they will be executed sequentially.
|
||||
|
|
@ -90,7 +88,6 @@ Output should adhere to the following format.
|
|||
]
|
||||
```
|
||||
Notice: your output JSON data section must start with **```json [**
|
||||
Firstly, the language of the response is...
|
||||
"""
|
||||
)
|
||||
THOUGHT_GUIDANCE = """
|
||||
|
|
@ -239,7 +236,7 @@ reply : The herb names have been successfully extracted. A total of 8 herb names
|
|||
Carefully review the history and respond to the user in the expected language to meet their requirements.
|
||||
If you have any deliverables that are helpful in explaining the results (such as files, metrics, quantitative results, etc.), provide brief descriptions of them.
|
||||
Your reply must be concise.
|
||||
{lanaguge_restruction}
|
||||
You must respond in {respond_language}
|
||||
Directly output your reply content. Do not add any output format.
|
||||
"""
|
||||
SUMMARY_PROMPT = """
|
||||
|
|
@ -247,3 +244,11 @@ Summarize what you have accomplished lately. Be concise.
|
|||
If you produce any deliverables, include their short descriptions and file paths. If there are any metrics or quantitative results, include them, too.
|
||||
If the deliverable is code, only output the file path.
|
||||
"""
|
||||
|
||||
RESPOND_LANGUAGE_DETECT = """
|
||||
The requirement is:
|
||||
{requirement}
|
||||
|
||||
Which Natural Language must you respond in?
|
||||
Output only the language type.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -32,9 +32,10 @@ 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.Default technology stack is HTML (.html), CSS (.css), and JavaScript (.js). When developing software, include this stack and add any specific programming languages to the instructions.
|
||||
13. If the the user message is a question. use 'reply to human' to respond to the question, and then end.
|
||||
14. Instructions and reply must be in the same language.
|
||||
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 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.
|
||||
"""
|
||||
TL_THOUGHT_GUIDANCE = (
|
||||
THOUGHT_GUIDANCE
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ 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,
|
||||
|
|
@ -91,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
|
||||
requirements_constraints: str = "" # the constraints in user requirements
|
||||
respond_language: str = "" # the constraints of respond language
|
||||
use_summary: bool = True # whether to summarize at the end
|
||||
|
||||
@model_validator(mode="after")
|
||||
|
|
@ -178,7 +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)
|
||||
### 1. Experience ###
|
||||
example = self._retrieve_experience()
|
||||
|
||||
|
|
@ -204,7 +206,7 @@ class RoleZero(Role):
|
|||
current_state=self.cmd_prompt_current_state,
|
||||
plan_status=plan_status,
|
||||
current_task=current_task,
|
||||
requirements_constraints=self.requirements_constraints,
|
||||
respond_language=self.respond_language,
|
||||
)
|
||||
|
||||
### Recent Observation ###
|
||||
|
|
@ -547,9 +549,7 @@ class RoleZero(Role):
|
|||
# Ensure reply to the human before the "end" command is executed. Hard code k=5 for checking.
|
||||
if not any(["reply_to_human" in memory.content for memory in self.get_memories(k=5)]):
|
||||
logger.info("manually reply to human")
|
||||
pattern = r"\[Language Restrictions\](.*?)\n"
|
||||
match = re.search(pattern, self.requirements_constraints, re.DOTALL)
|
||||
reply_to_human_prompt = REPORT_TO_HUMAN_PROMPT.format(lanaguge_restruction=match.group(0) if match else "")
|
||||
reply_to_human_prompt = REPORT_TO_HUMAN_PROMPT.format(respond_language=self.respond_language)
|
||||
async with ThoughtReporter(enable_llm_stream=True) as reporter:
|
||||
await reporter.async_report({"type": "quick"})
|
||||
reply_content = await self.llm.aask(self.llm.format_msg(memory + [UserMessage(reply_to_human_prompt)]))
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ Explanation: The requirement is about software development. Assign each tasks to
|
|||
"args": {
|
||||
"task_id": "1",
|
||||
"dependent_task_ids": [],
|
||||
"instruction": "Create a product requirement document (PRD) outlining the features, user interface. Using ... as the programming language.",
|
||||
"instruction": "Using HTML, CSS, 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": "Design the software architecture for the CLI snake game, including the choice of programming language, libraries, and data flow. Using ... as the programming language.",
|
||||
"instruction": "Using HTML, CSS, JavaScrip as the programming language. Design the software architecture for the CLI snake game, including the data flow.",
|
||||
"assignee": "Bob"
|
||||
}
|
||||
},
|
||||
|
|
@ -513,7 +513,7 @@ Explanation: The requirement is about software development. Assign each tasks to
|
|||
{
|
||||
"command_name": "TeamLeader.publish_message",
|
||||
"args": {
|
||||
"content": "Create a cli snake game. Using ... as the programming language.",
|
||||
"content": "Using HTML, CSS, JavaScrip as the programming language. Create a cli snake game.",
|
||||
"send_to": "Alice"
|
||||
}
|
||||
},
|
||||
|
|
|
|||
21
src/index.html
Normal file
21
src/index.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Flappy Bird</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="game">
|
||||
<div id="bird"></div>
|
||||
<div id="pipes">
|
||||
<div class="pipe"></div>
|
||||
<div class="pipe"></div>
|
||||
</div>
|
||||
<div id="ground"></div>
|
||||
<div id="score">Score: 0</div>
|
||||
</div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue