Skip to content

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

update

seeker-jie806853b223ad
diff --git a/metagpt/roles/product_manager.py b/metagpt/roles/product_manager.py
index 334f36f52..0f3613866 100644
--- a/metagpt/roles/product_manager.py
+++ b/metagpt/roles/product_manager.py
@@ -34,7 +34,6 @@ class ProductManager(RoleZero):
goal: str = "Create a Product Requirement Document or market research/competitive product research."
constraints: str = "utilize the same language as the user requirements for seamless communication"
instruction: str = PRODUCT_MANAGER_INSTRUCTION
- max_react_loop: int = 50
tools: list[str] = ["RoleZero", Browser.__name__, Editor.__name__, SearchEnhancedQA.__name__]
todo_action: str = any_to_name(WritePRD)
diff --git a/metagpt/schema.py b/metagpt/schema.py
index 70933d9bc..52badcc21 100644
--- a/metagpt/schema.py
+++ b/metagpt/schema.py
@@ -689,12 +689,6 @@ class Plan(BaseModel):
Append a new task with task_id (number) to the end of existing task sequences.
If dependent_task_ids is not empty, the task will depend on the tasks with the ids in the list.
Note that the assignee should be the 'name' of the role.
- Args:
- task_id (str): The task id to be appended to the existing task sequence
- dependent_task_ids (list[str]): The task ids that the new task depends on
- instruction (str): The instruction of the new task
- assignee (str): The assignee of the new task
- task_type (str, optional): The type of the new task, default is empty string
"""
new_task = Task(
task_id=task_id,
diff --git a/tests/metagpt/roles/test_product_manager.py b/tests/metagpt/roles/test_product_manager.py
new file mode 100644
index 000000000..9a28a3296
--- /dev/null
+++ b/tests/metagpt/roles/test_product_manager.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+@Time : 2023/5/16 14:50
+@Author : alexanderwu
+@File : test_product_manager.py
+"""
+import json
+
+import pytest
+
+from metagpt.actions import WritePRD
+from metagpt.const import REQUIREMENT_FILENAME
+from metagpt.context import Context
+from metagpt.logs import logger
+from metagpt.roles import ProductManager
+from metagpt.utils.common import any_to_str
+from tests.metagpt.roles.mock import MockMessages
+
+
+async def test_product_manager(new_filename):
+ context = Context()
+ try:
+ assert context.git_repo is None
+ assert context.repo is None
+ product_manager = ProductManager(context=context)
+ # prepare documents
+ rsp = await product_manager.run(MockMessages.req)
+ assert context.git_repo
+ assert context.repo
+ assert rsp.cause_by == any_to_str(WritePRD)
+ assert REQUIREMENT_FILENAME in context.repo.docs.changed_files
+ logger.info(rsp)
+ assert len(rsp.content) > 0
+ doc = list(rsp.instruct_content.docs.values())[0]
+ m = json.loads(doc.content)
+ assert m["Original Requirements"] == MockMessages.req.content
+
+ # nothing to do
+ rsp = await product_manager.run(rsp)
+ assert rsp is None
+ except Exception as e:
+ assert not e
+ finally:
+ context.git_repo.delete_repository()
+
+
+if __name__ == "__main__":
+ pytest.main([__file__, "-s"])