Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

update prompt indention

stellahsrb130751b01df
diff --git a/metagpt/actions/di/write_plan.py b/metagpt/actions/di/write_plan.py
index 04aed7e17..8d6eccf57 100644
--- a/metagpt/actions/di/write_plan.py
+++ b/metagpt/actions/di/write_plan.py
@@ -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)