🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
Merge branch 'dev' into dev_make_tools
刘棒棒47000009531d
diff --cc metagpt/roles/ml_engineer.pyindex 3e656304b,73aba1fe8..7e5cc8caf--- a/metagpt/roles/ml_engineer.py+++ b/metagpt/roles/ml_engineer.py@@@ -4,11 -4,10 +4,10 @@@ from datetime import datetimimport fire- from metagpt.actions import Actionfrom metagpt.actions.debug_code import DebugCodefrom metagpt.actions.execute_code import ExecutePyCode- from metagpt.actions.ml_da_action import AskReview, SummarizeAnalysis, Reflect, ReviewConst+ from metagpt.actions.ml_da_action import AskReview, SummarizeAnalysis, Reflect, ReviewConst, UpdateDataColumns-from metagpt.actions.write_analysis_code import WriteCodeByGenerate, WriteCodeWithTools+from metagpt.actions.write_analysis_code import WriteCodeByGenerate, WriteCodeWithTools, MakeToolsfrom metagpt.actions.write_code_steps import WriteCodeStepsfrom metagpt.actions.write_plan import WritePlanfrom metagpt.actions.write_plan import update_plan_from_rsp, precheck_update_plan_from_rsp@@@ -48,12 -31,10 +31,12 @@@ class MLEngineer(Role)self._watch([DownloadData, SubmitResult])self.plan = Plan(goal=goal)+ self.make_udfs = False # user-defined functions+ self.use_udfs = False- self.use_tools = True- self.use_code_steps = Trueself.execute_code = ExecutePyCode()self.auto_run = auto_run+ self.use_tools = use_tools+ self.use_code_steps = use_code_stepsself.data_desc = {}# memory for working on each task, discarded each time a task is done@@@ -334,24 -260,6 +317,24 @@@ if __name__ == "__main__"# requirement = "Run data analysis on sklearn Wine recognition dataset, include a plot, and train a model to predict wine class (20% as validation), and show validation accuracy"# requirement = "Run data analysis on sklearn Wisconsin Breast Cancer dataset, include a plot, train a model to predict targets (20% as validation), and show validation accuracy"# requirement = "Run EDA and visualization on this dataset, train a model to predict survival, report metrics on validation set (20%), dataset: workspace/titanic/train.csv"+- async def main(requirement: str = requirement, auto_run: bool = True):++ async def run_udfs(requirement: str = requirement, auto_run: bool = True):+ role = MLEngineer(goal=requirement, auto_run=auto_run)+ # make udfs+ role.use_tools = False+ role.use_code_steps = False+ role.make_udfs = True+ role.use_udfs = False+ await role.run(requirement)+ # use udfs+ role.reset()+ role.make_udfs = False+ role.use_udfs = True+ role.use_code_steps = False+ role.use_tools = False+ await role.run(requirement)++# requirement = "Perform data analysis on the provided data. Train a model to predict the target variable Survived. Include data preprocessing, feature engineering, and modeling in your pipeline. The metric is accuracy."# data_path = f"{DATA_PATH}/titanic"