mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
update prompt indention
This commit is contained in:
parent
4d072997fa
commit
b130751b01
1 changed files with 14 additions and 14 deletions
|
|
@ -16,9 +16,7 @@ from metagpt.schema import Message, Plan, Task
|
|||
from metagpt.strategy.task_type import TaskType
|
||||
from metagpt.utils.common import CodeParser
|
||||
|
||||
|
||||
class WritePlan(Action):
|
||||
PROMPT_TEMPLATE: str = """
|
||||
PROMPT_TEMPLATE: str = """
|
||||
# Context:
|
||||
{context}
|
||||
# Available Task Types:
|
||||
|
|
@ -29,21 +27,23 @@ If you are modifying an existing plan, carefully follow the instruction, don't m
|
|||
If you encounter errors on the current task, revise and output the current single task only.
|
||||
Output a list of jsons following the format:
|
||||
```json
|
||||
[
|
||||
{{
|
||||
"task_id": str = "unique identifier for a task in plan, can be an ordinal",
|
||||
"dependent_task_ids": list[str] = "ids of tasks prerequisite to this task",
|
||||
"instruction": "what you should do in this task, one short phrase or sentence.",
|
||||
"task_type": "type of this task, should be one of Available Task Types.",
|
||||
}},
|
||||
...
|
||||
]
|
||||
[
|
||||
{{
|
||||
"task_id": str = "unique identifier for a task in plan, can be an ordinal",
|
||||
"dependent_task_ids": list[str] = "ids of tasks prerequisite to this task",
|
||||
"instruction": "what you should do in this task, one short phrase or sentence.",
|
||||
"task_type": "type of this task, should be one of Available Task Types.",
|
||||
}},
|
||||
...
|
||||
]
|
||||
```
|
||||
"""
|
||||
"""
|
||||
|
||||
|
||||
class WritePlan(Action):
|
||||
async def run(self, context: list[Message], max_tasks: int = 5) -> str:
|
||||
task_type_desc = "\n".join([f"- **{tt.type_name}**: {tt.value.desc}" for tt in TaskType])
|
||||
prompt = self.PROMPT_TEMPLATE.format(
|
||||
prompt = PROMPT_TEMPLATE.format(
|
||||
context="\n".join([str(ct) for ct in context]), max_tasks=max_tasks, task_type_desc=task_type_desc
|
||||
)
|
||||
rsp = await self._aask(prompt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue