mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-05 14:55:18 +02:00
dynamic correction
This commit is contained in:
parent
744a4bc4fe
commit
f1f49c076c
2 changed files with 4 additions and 25 deletions
|
|
@ -73,12 +73,10 @@ Fifthly, describe if you should terminate, you should use **end** command to ter
|
|||
- You have completed the overall user requirement
|
||||
- All tasks are finished and current task is empty
|
||||
Finally, combine your thoughts, describe what you want to do conscisely in 20 words, then follow your thoughts to list the commands, adhering closely to the instructions provided.
|
||||
"""
|
||||
""".strip()
|
||||
REGENERATE_PROMPT = """
|
||||
Review the history carefully and consider human's feedback:
|
||||
{human_rsp}
|
||||
provide different commands.
|
||||
Describe if you should terminate using **end** command, or try a different approach and output different commands. You are NOT allowed to provide the same commands again.
|
||||
Review and reflect on the history carefully, provide different commands.
|
||||
Describe if you should terminate using **end** command, or use **RoleZero.ask_human** to ask human for help, or try a different approach and output different commands. You are NOT allowed to provide the same commands again.
|
||||
Your reflection, then the commands in a json array:
|
||||
"""
|
||||
JSON_REPAIR_PROMPT = """
|
||||
|
|
@ -103,15 +101,3 @@ Software development tasks are NOT quick questions.
|
|||
However, these programming-related tasks are quick questions: writing trivial code snippets (fewer than 30 lines), filling a single function or class, explaining concepts, writing tutorials and documentation.
|
||||
Respond with a concise thought then a YES if the question is a quick question, otherwise, a NO. Your response:
|
||||
"""
|
||||
ASK_HUMAN_COMMAND = """
|
||||
```json
|
||||
[
|
||||
{
|
||||
"command_name": "RoleZero.ask_human",
|
||||
"args": {
|
||||
"question": "I'm a little uncertain about the next step, could you provide me with some guidance?"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ from metagpt.exp_pool.context_builders import RoleZeroContextBuilder
|
|||
from metagpt.exp_pool.serializers import RoleZeroSerializer
|
||||
from metagpt.logs import logger
|
||||
from metagpt.prompts.di.role_zero import (
|
||||
ASK_HUMAN_COMMAND,
|
||||
CMD_PROMPT,
|
||||
JSON_REPAIR_PROMPT,
|
||||
QUICK_THINK_PROMPT,
|
||||
|
|
@ -274,13 +273,7 @@ class RoleZero(Role):
|
|||
# In this case, ask human for help and regenerate
|
||||
# TODO: switch to llm_cached_aask
|
||||
logger.warning(f"Duplicate response detected: {command_rsp}")
|
||||
human_rsp = await self.ask_human(
|
||||
question="I'm a little uncertain about the next step, could you provide me with some guidance?"
|
||||
)
|
||||
regenerate_req = req + [
|
||||
AIMessage(content=ASK_HUMAN_COMMAND),
|
||||
UserMessage(content=REGENERATE_PROMPT.format(human_rsp=human_rsp)),
|
||||
]
|
||||
regenerate_req = req + [UserMessage(content=REGENERATE_PROMPT)]
|
||||
regenerate_req = self.llm.format_msg(regenerate_req)
|
||||
command_rsp = await self.llm.aask(regenerate_req)
|
||||
return command_rsp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue