🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
Final version
didi072839af7f75
diff --git a/examples/aflow/experiments/optimize_drop.py b/examples/aflow/experiments/optimize_drop.pyindex d4cc2412f..46e53b81a 100644--- a/examples/aflow/experiments/optimize_drop.py+++ b/examples/aflow/experiments/optimize_drop.py@@ -5,7 +5,6 @@from metagpt.configs.models_config import ModelsConfig-from metagpt.ext.aflow.data.download_data import downloadfrom metagpt.ext.aflow.scripts.optimizer import DatasetType, Optimizer, QuestionType# DatasetType, QuestionType, and OptimizerType definitions@@ -24,7 +23,7 @@ optimized_path: str = "metagpt/ext/aflow/scripts/optimized" # Optimized Resultinitial_round: int = 1 # Corrected the case from Initial_round to initial_roundmax_rounds: int = 20 # The max iteration of AFLOW.check_convergence: bool = True # Whether Early Stop-validation_rounds: int = 5 # The validation rounds of AFLOW.+validation_rounds: int = 5 # The validation rounds of AFLOW.# Config llm model, you can modify `config/config2.yaml` to use more llms.mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")@@ -33,7 +32,7 @@ claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")# Config operators.operators = ["Custom", # It's basic unit of a fixed node. optimizer can modify its prompt to get vairous nodes.- "AnswerGenerate", # It's for qa+ "AnswerGenerate", # It's for qa# "CustomCodeGenerate", # It's for code"ScEnsemble", # It's for code, math and qa# "Test", # It's for codediff --git a/examples/aflow/experiments/optimize_gsm8k.py b/examples/aflow/experiments/optimize_gsm8k.pyindex d1dcad068..008783eac 100644--- a/examples/aflow/experiments/optimize_gsm8k.py+++ b/examples/aflow/experiments/optimize_gsm8k.py@@ -5,7 +5,6 @@from metagpt.configs.models_config import ModelsConfig-from metagpt.ext.aflow.data.download_data import downloadfrom metagpt.ext.aflow.scripts.optimizer import DatasetType, Optimizer, QuestionType# DatasetType, QuestionType, and OptimizerType definitions@@ -24,7 +23,7 @@ optimized_path: str = "metagpt/ext/aflow/scripts/optimized" # Optimized Resultinitial_round: int = 1 # Corrected the case from Initial_round to initial_roundmax_rounds: int = 20 # The max iteration of AFLOW.check_convergence: bool = True # Whether Early Stop-validation_rounds: int = 5 # The validation rounds of AFLOW.+validation_rounds: int = 5 # The validation rounds of AFLOW.# Config llm model, you can modify `config/config2.yaml` to use more llms.mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")diff --git a/examples/aflow/experiments/optimize_hotpotqa.py b/examples/aflow/experiments/optimize_hotpotqa.pyindex 2a1779327..7d4a0230a 100644--- a/examples/aflow/experiments/optimize_hotpotqa.py+++ b/examples/aflow/experiments/optimize_hotpotqa.py@@ -5,7 +5,6 @@from metagpt.configs.models_config import ModelsConfig-from metagpt.ext.aflow.data.download_data import downloadfrom metagpt.ext.aflow.scripts.optimizer import DatasetType, Optimizer, QuestionType# DatasetType, QuestionType, and OptimizerType definitions@@ -24,7 +23,7 @@ optimized_path: str = "metagpt/ext/aflow/scripts/optimized" # Optimized Resultinitial_round: int = 1 # Corrected the case from Initial_round to initial_roundmax_rounds: int = 20 # The max iteration of AFLOW.check_convergence: bool = True # Whether Early Stop-validation_rounds: int = 5 # The validation rounds of AFLOW.+validation_rounds: int = 5 # The validation rounds of AFLOW.# Config llm model, you can modify `config/config2.yaml` to use more llms.mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")@@ -33,7 +32,7 @@ claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")# Config operators.operators = ["Custom", # It's basic unit of a fixed node. optimizer can modify its prompt to get vairous nodes.- "AnswerGenerate", # It's for qa+ "AnswerGenerate", # It's for qa# "CustomCodeGenerate", # It's for code"ScEnsemble", # It's for code, math and qa# "Test", # It's for codediff --git a/examples/aflow/experiments/optimize_humaneval.py b/examples/aflow/experiments/optimize_humaneval.pyindex ef7b8ad0c..ef99f8210 100644--- a/examples/aflow/experiments/optimize_humaneval.py+++ b/examples/aflow/experiments/optimize_humaneval.py@@ -5,7 +5,6 @@from metagpt.configs.models_config import ModelsConfig-from metagpt.ext.aflow.data.download_data import downloadfrom metagpt.ext.aflow.scripts.optimizer import DatasetType, Optimizer, QuestionType# DatasetType, QuestionType, and OptimizerType definitions@@ -24,7 +23,7 @@ optimized_path: str = "metagpt/ext/aflow/scripts/optimized" # Optimized Resultinitial_round: int = 1 # Corrected the case from Initial_round to initial_roundmax_rounds: int = 20 # The max iteration of AFLOW.check_convergence: bool = True # Whether Early Stop-validation_rounds: int = 5 # The validation rounds of AFLOW.+validation_rounds: int = 5 # The validation rounds of AFLOW.# Config llm model, you can modify `config/config2.yaml` to use more llms.mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")@@ -34,9 +33,9 @@ claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")operators = ["Custom", # It's basic unit of a fixed node. optimizer can modify its prompt to get vairous nodes.# "AnswerGenerate", # It's for qa- "CustomCodeGenerate", # It's for code+ "CustomCodeGenerate", # It's for code"ScEnsemble", # It's for code, math and qa- "Test", # It's for code+ "Test", # It's for code# "Programmer", # It's for math]diff --git a/examples/aflow/experiments/optimize_math.py b/examples/aflow/experiments/optimize_math.pyindex e968716e2..d049e2c88 100644--- a/examples/aflow/experiments/optimize_math.py+++ b/examples/aflow/experiments/optimize_math.py@@ -5,7 +5,6 @@from metagpt.configs.models_config import ModelsConfig-from metagpt.ext.aflow.data.download_data import downloadfrom metagpt.ext.aflow.scripts.optimizer import DatasetType, Optimizer, QuestionType# DatasetType, QuestionType, and OptimizerType definitions@@ -24,7 +23,7 @@ optimized_path: str = "metagpt/ext/aflow/scripts/optimized" # Optimized Resultinitial_round: int = 1 # Corrected the case from Initial_round to initial_roundmax_rounds: int = 20 # The max iteration of AFLOW.check_convergence: bool = True # Whether Early Stop-validation_rounds: int = 5 # The validation rounds of AFLOW.+validation_rounds: int = 5 # The validation rounds of AFLOW.# Config llm model, you can modify `config/config2.yaml` to use more llms.mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")diff --git a/examples/aflow/experiments/optimize_mbpp.py b/examples/aflow/experiments/optimize_mbpp.pyindex c698aace6..de71abaec 100644--- a/examples/aflow/experiments/optimize_mbpp.py+++ b/examples/aflow/experiments/optimize_mbpp.py@@ -5,7 +5,6 @@from metagpt.configs.models_config import ModelsConfig-from metagpt.ext.aflow.data.download_data import downloadfrom metagpt.ext.aflow.scripts.optimizer import DatasetType, Optimizer, QuestionType# DatasetType, QuestionType, and OptimizerType definitions@@ -24,7 +23,7 @@ optimized_path: str = "metagpt/ext/aflow/scripts/optimized" # Optimized Resultinitial_round: int = 1 # Corrected the case from Initial_round to initial_roundmax_rounds: int = 20 # The max iteration of AFLOW.check_convergence: bool = True # Whether Early Stop-validation_rounds: int = 5 # The validation rounds of AFLOW.+validation_rounds: int = 5 # The validation rounds of AFLOW.# Config llm model, you can modify `config/config2.yaml` to use more llms.mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")@@ -34,9 +33,9 @@ claude_llm_config = ModelsConfig.default().get("claude-3-5-sonnet-20240620")operators = ["Custom", # It's basic unit of a fixed node. optimizer can modify its prompt to get vairous nodes.# "AnswerGenerate", # It's for qa- "CustomCodeGenerate", # It's for code+ "CustomCodeGenerate", # It's for code"ScEnsemble", # It's for code, math and qa- "Test", # It's for code+ "Test", # It's for code# "Programmer", # It's for math]diff --git a/examples/aflow/optimize.py b/examples/aflow/optimize.pyindex 1ba938af4..fcc892ee4 100644--- a/examples/aflow/optimize.py+++ b/examples/aflow/optimize.py@@ -24,7 +24,7 @@ optimized_path: str = "metagpt/ext/aflow/scripts/optimized" # Optimized Resultinitial_round: int = 1 # Corrected the case from Initial_round to initial_roundmax_rounds: int = 20 # The max iteration of AFLOW.check_convergence: bool = True # Whether Early Stop-validation_rounds: int = 5 # The validation rounds of AFLOW.+validation_rounds: int = 5 # The validation rounds of AFLOW.# Config llm model, you can modify `config/config2.yaml` to use more llms.mini_llm_config = ModelsConfig.default().get("gpt-4o-mini")diff --git a/metagpt/ext/aflow/benchmark/mbpp.py b/metagpt/ext/aflow/benchmark/mbpp.pyindex 5e4ea94e3..62279ec18 100644--- a/metagpt/ext/aflow/benchmark/mbpp.py+++ b/metagpt/ext/aflow/benchmark/mbpp.py@@ -4,8 +4,8 @@ from typing import Any, Callable, Dict, List, Optional, Tuplefrom tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed-from metagpt.ext.aflow.scripts.utils import sanitizefrom metagpt.ext.aflow.benchmark.benchmark import BaseBenchmark+from metagpt.ext.aflow.scripts.utils import sanitizefrom metagpt.logs import loggerdiff --git a/metagpt/ext/aflow/data/download_data.py b/metagpt/ext/aflow/data/download_data.pyindex 18e702be9..53faf05e5 100644--- a/metagpt/ext/aflow/data/download_data.py+++ b/metagpt/ext/aflow/data/download_data.py@@ -55,11 +55,7 @@ datasets_to_download: Dict[str, Dict[str, str]] = {"filename": "aflow_data.tar.gz","extract_path": "metagpt/ext/aflow/data",},- "results": {- "url": "",- "filename": "result.tar.gz",- "extract_path": "metagpt/ext/aflow/data/results"- },+ "results": {"url": "", "filename": "result.tar.gz", "extract_path": "metagpt/ext/aflow/data/results"},"initial_rounds": {"url": "https://drive.google.com/uc?export=download&id=1UBoW4WBWjX2gs4I_jq3ALdXeLdwDJMdP","filename": "initial_rounds.tar.gz",@@ -72,14 +68,17 @@ def is_directory_empty(path: str) -> bool:"""Check if the directory is empty"""return len(os.listdir(path)) == 0+def download(datasets):"""Main function to process all selected datasets"""for dataset_name in datasets:dataset = datasets_to_download[dataset_name]extract_path = dataset["extract_path"]-+if os.path.exists(extract_path) and not is_directory_empty(extract_path):- logger.info(f"Target folder {extract_path} for {dataset_name} is not empty, skipping download and extraction.")+ logger.info(+ f"Target folder {extract_path} for {dataset_name} is not empty, skipping download and extraction."+ )continue-+process_dataset(dataset["url"], dataset["filename"], extract_path)