mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-06 14:22:46 +02:00
Merge branch 'update_RoleZero_summary_prompt' into 'mgx_ops'
优化:更新回复提示词 See merge request pub/MetaGPT!347
This commit is contained in:
commit
07cbd4be22
2 changed files with 19 additions and 9 deletions
|
|
@ -220,15 +220,25 @@ However, you MUST respond to the user message by yourself directly, DON'T ask yo
|
|||
"""
|
||||
|
||||
REPORT_TO_HUMAN_PROMPT = """
|
||||
# Restrictions
|
||||
{requirements_constraints}
|
||||
## Examlpe
|
||||
example 1:
|
||||
User requirement: create a 2048 game
|
||||
reply: The development of the 2048 game has been completed. All files (index.html, style.css, and script.js) have been created and reviewed.
|
||||
|
||||
You have just finished all tasks.
|
||||
Reply to the human requirements.
|
||||
Do not output any other format.
|
||||
Your reply is:
|
||||
example 2:
|
||||
User requirement: Crawl and extract all the herb names from the website, Tell me the number of herbs.
|
||||
reply : The herb names have been successfully extracted. A total of 8 herb names were extracted.
|
||||
|
||||
------------
|
||||
|
||||
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}
|
||||
Directly output your reply content. Do not add any output format.
|
||||
"""
|
||||
SUMMARY_PROMPT = """
|
||||
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.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -495,9 +495,9 @@ 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")
|
||||
reply_to_human_prompt = REPORT_TO_HUMAN_PROMPT.format(
|
||||
requirements_constraints=self.requirements_constraints,
|
||||
)
|
||||
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 "")
|
||||
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)]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue