diff --git a/examples/mi/machine_learning.py b/examples/mi/machine_learning.py index ee3b47f26..a8ab5051e 100644 --- a/examples/mi/machine_learning.py +++ b/examples/mi/machine_learning.py @@ -1,13 +1,13 @@ -import asyncio +import fire from metagpt.roles.mi.interpreter import Interpreter -async def main(requirement: str): - mi = Interpreter(auto_run=True, use_tools=False) +async def main(auto_run: bool = True): + 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." + mi = Interpreter(auto_run=auto_run) await mi.run(requirement) 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." - asyncio.run(main(requirement)) + fire.Fire(main) diff --git a/metagpt/actions/mi/execute_nb_code.py b/metagpt/actions/mi/execute_nb_code.py index a8c9c3085..0371d556c 100644 --- a/metagpt/actions/mi/execute_nb_code.py +++ b/metagpt/actions/mi/execute_nb_code.py @@ -182,7 +182,7 @@ class ExecuteNbCode(Action): outputs = self.parse_outputs(self.nb.cells[-1].outputs) outputs, success = truncate(remove_escape_and_color_codes(outputs), is_success=success) - if "!pip" in outputs: + if "!pip" in code: success = False return outputs, success diff --git a/metagpt/strategy/planner.py b/metagpt/strategy/planner.py index 851d45893..99d16f78b 100644 --- a/metagpt/strategy/planner.py +++ b/metagpt/strategy/planner.py @@ -122,7 +122,7 @@ class Planner(BaseModel): ) # "confirm, ... (more content, such as changing downstream tasks)" if confirmed_and_more: self.working_memory.add(Message(content=review, role="user", cause_by=AskReview)) - await self.update_plan(review) + await self.update_plan() def get_useful_memories(self, task_exclude_field=None) -> list[Message]: """find useful memories only to reduce context length and improve performance""" diff --git a/metagpt/tools/tool_registry.py b/metagpt/tools/tool_registry.py index 5fbd39421..02eecb0f3 100644 --- a/metagpt/tools/tool_registry.py +++ b/metagpt/tools/tool_registry.py @@ -9,7 +9,6 @@ from __future__ import annotations import inspect import os -import re from collections import defaultdict import yaml @@ -109,7 +108,8 @@ def register_tool(tool_type: str = "other", schema_path: str = "", **kwargs): # Get the file path where the function / class is defined and the source code file_path = inspect.getfile(cls) if "metagpt" in file_path: - file_path = re.search("metagpt.+", file_path).group(0) + # split to handle ../metagpt/metagpt/tools/... where only metapgt/tools/... is needed + file_path = "metagpt" + file_path.split("metagpt")[-1] source_code = inspect.getsource(cls) TOOL_REGISTRY.register_tool( diff --git a/requirements.txt b/requirements.txt index c89a18928..4ea6dc5d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ lancedb==0.4.0 langchain==0.0.352 loguru==0.6.0 meilisearch==0.21.0 -numpy>=1.24.3 +numpy>=1.24.3,<1.25.0 openai==1.6.0 openpyxl beautifulsoup4==4.12.2 diff --git a/setup.py b/setup.py index be3956ea4..ed3d5f78f 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ extras_require["dev"] = (["pylint~=3.0.3", "black~=23.3.0", "isort~=5.12.0", "pr setup( name="metagpt", - version="0.7.0", + version="0.7.2", description="The Multi-Agent Framework", long_description=long_description, long_description_content_type="text/markdown",