🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
use typing.List instead of list
geekan8bec6e98cc8a
diff --git a/metagpt/actions/action_node.py b/metagpt/actions/action_node.pyindex 58688aefa..4376e09ed 100644--- a/metagpt/actions/action_node.py+++ b/metagpt/actions/action_node.py@@ -4,6 +4,9 @@@Time : 2023/12/11 18:45@Author : alexanderwu@File : action_node.py++NOTE: You should use typing.List instead of list to do type annotation. Because in the markdown extraction process,+ we can use typing to extract the type of the node, but we cannot use built-in list to extract."""import jsonfrom typing import Any, Dict, Generic, List, Optional, Tuple, Type, TypeVardiff --git a/metagpt/actions/design_api_an.py b/metagpt/actions/design_api_an.pyindex 0a303cdd5..7d6802381 100644--- a/metagpt/actions/design_api_an.py+++ b/metagpt/actions/design_api_an.py@@ -5,6 +5,8 @@@Author : alexanderwu@File : design_api_an.py"""+from typing import List+from metagpt.actions.action_node import ActionNodefrom metagpt.logs import loggerfrom metagpt.utils.mermaid import MMC1, MMC2@@ -22,7 +24,7 @@ PROJECT_NAME = ActionNode(FILE_LIST = ActionNode(key="File list",- expected_type=list[str],+ expected_type=List[str],instruction="Only need relative paths. ALWAYS write a main.py or app.py here",example=["main.py", "game.py"],)diff --git a/metagpt/actions/project_management_an.py b/metagpt/actions/project_management_an.pyindex 6208c1051..215a67202 100644--- a/metagpt/actions/project_management_an.py+++ b/metagpt/actions/project_management_an.py@@ -5,26 +5,28 @@@Author : alexanderwu@File : project_management_an.py"""+from typing import List+from metagpt.actions.action_node import ActionNodefrom metagpt.logs import loggerREQUIRED_PYTHON_PACKAGES = ActionNode(key="Required Python packages",- expected_type=list[str],+ expected_type=List[str],instruction="Provide required Python packages in requirements.txt format.",example=["flask==1.1.2", "bcrypt==3.2.0"],)REQUIRED_OTHER_LANGUAGE_PACKAGES = ActionNode(key="Required Other language third-party packages",- expected_type=list[str],+ expected_type=List[str],instruction="List down the required packages for languages other than Python.",example=["No third-party dependencies required"],)LOGIC_ANALYSIS = ActionNode(key="Logic Analysis",- expected_type=list[list[str]],+ expected_type=List[List[str]],instruction="Provide a list of files with the classes/methods/functions to be implemented, ""including dependency analysis and imports.",example=[@@ -35,7 +37,7 @@ LOGIC_ANALYSIS = ActionNode(TASK_LIST = ActionNode(key="Task list",- expected_type=list[str],+ expected_type=List[str],instruction="Break down the tasks into a list of filenames, prioritized by dependency order.",example=["game.py", "main.py"],)diff --git a/metagpt/actions/write_prd_an.py b/metagpt/actions/write_prd_an.pyindex 8698c739f..d58d72f64 100644--- a/metagpt/actions/write_prd_an.py+++ b/metagpt/actions/write_prd_an.py@@ -5,6 +5,7 @@@Author : alexanderwu@File : write_prd_an.py"""+from typing import Listfrom metagpt.actions.action_node import ActionNodefrom metagpt.logs import logger@@ -39,14 +40,14 @@ PROJECT_NAME = ActionNode(PRODUCT_GOALS = ActionNode(key="Product Goals",- expected_type=list[str],+ expected_type=List[str],instruction="Provide up to three clear, orthogonal product goals.",example=["Create an engaging user experience", "Improve accessibility, be responsive", "More beautiful UI"],)USER_STORIES = ActionNode(key="User Stories",- expected_type=list[str],+ expected_type=List[str],instruction="Provide up to 3 to 5 scenario-based user stories.",example=["As a player, I want to be able to choose difficulty levels",@@ -59,7 +60,7 @@ USER_STORIES = ActionNode(COMPETITIVE_ANALYSIS = ActionNode(key="Competitive Analysis",- expected_type=list[str],+ expected_type=List[str],instruction="Provide 5 to 7 competitive products.",example=["2048 Game A: Simple interface, lacks responsive features",@@ -98,7 +99,7 @@ REQUIREMENT_ANALYSIS = ActionNode(REQUIREMENT_POOL = ActionNode(key="Requirement Pool",- expected_type=list[list[str]],+ expected_type=List[List[str]],instruction="List down the top-5 requirements with their priority (P0, P1, P2).",example=[["P0", "The main code ..."], ["P0", "The game algorithm ..."]],)diff --git a/metagpt/actions/write_review.py b/metagpt/actions/write_review.pyindex 94dd9951b..13690a1a5 100644--- a/metagpt/actions/write_review.py+++ b/metagpt/actions/write_review.py@@ -9,8 +9,6 @@ from typing import Listfrom metagpt.actions import Actionfrom metagpt.actions.action_node import ActionNode-# from metagpt.llm import LLM-REVIEW = ActionNode(key="Review",expected_type=List[str],@@ -24,7 +22,7 @@ REVIEW = ActionNode(LGTM = ActionNode(key="LGTM",expected_type=str,- instruction="If the output is good enough, give a LGTM (Looks Good To Me) to the writer, "+ instruction="LGTM/LBTM. If the output is good enough, give a LGTM (Looks Good To Me) to the writer, ""else LBTM (Looks Bad To Me).",example="LGTM",)