From 2fc18b49f9707c4004d854720bc11e5579f82464 Mon Sep 17 00:00:00 2001
From: yzlin
Date: Sun, 18 Feb 2024 17:06:39 +0800
Subject: [PATCH 1/2] unified Interpreter naming
---
README.md | 2 +-
examples/ci/README.md | 18 ------------------
examples/mi/README.md | 18 ++++++++++++++++++
examples/{ci => mi}/crawl_webpage.py | 6 +++---
examples/{ci => mi}/data_visualization.py | 6 +++---
examples/{ci => mi}/email_summary.py | 6 +++---
examples/{ci => mi}/imitate_webpage.py | 6 +++---
examples/{ci => mi}/machine_learning.py | 6 +++---
examples/{ci => mi}/ml_engineer_with_tools.py | 2 +-
examples/{ci => mi}/ocr_receipt.py | 8 ++++----
examples/{ci => mi}/rm_image_background.py | 6 +++---
examples/{ci => mi}/sd_tool_usage.py | 6 +++---
examples/{ci => mi}/solve_math_problems.py | 6 +++---
metagpt/actions/__init__.py | 6 +++---
metagpt/actions/{ci => mi}/__init__.py | 0
metagpt/actions/{ci => mi}/ask_review.py | 0
metagpt/actions/{ci => mi}/debug_code.py | 2 +-
metagpt/actions/{ci => mi}/execute_nb_code.py | 0
metagpt/actions/{ci => mi}/ml_action.py | 6 +++---
.../actions/{ci => mi}/write_analysis_code.py | 2 +-
metagpt/actions/{ci => mi}/write_plan.py | 2 +-
metagpt/prompts/{ci => mi}/__init__.py | 0
metagpt/prompts/{ci => mi}/ml_action.py | 0
.../prompts/{ci => mi}/write_analysis_code.py | 0
metagpt/roles/{ci => mi}/__init__.py | 0
.../code_interpreter.py => mi/interpreter.py} | 12 ++++++------
metagpt/roles/{ci => mi}/ml_engineer.py | 10 +++++-----
metagpt/strategy/planner.py | 4 ++--
metagpt/strategy/solver.py | 4 ++--
.../actions/{ci => mi}/test_ask_review.py | 2 +-
.../actions/{ci => mi}/test_debug_code.py | 2 +-
.../actions/{ci => mi}/test_execute_nb_code.py | 2 +-
.../actions/{ci => mi}/test_ml_action.py | 2 +-
.../{ci => mi}/test_write_analysis_code.py | 4 ++--
.../actions/{ci => mi}/test_write_plan.py | 2 +-
.../test_interpreter.py} | 12 ++++++------
.../roles/{ci => mi}/test_ml_engineer.py | 10 +++++-----
tests/metagpt/utils/test_save_code.py | 2 +-
38 files changed, 91 insertions(+), 91 deletions(-)
delete mode 100644 examples/ci/README.md
create mode 100644 examples/mi/README.md
rename examples/{ci => mi}/crawl_webpage.py (76%)
rename examples/{ci => mi}/data_visualization.py (55%)
rename examples/{ci => mi}/email_summary.py (90%)
rename examples/{ci => mi}/imitate_webpage.py (81%)
rename examples/{ci => mi}/machine_learning.py (66%)
rename examples/{ci => mi}/ml_engineer_with_tools.py (94%)
rename examples/{ci => mi}/ocr_receipt.py (72%)
rename examples/{ci => mi}/rm_image_background.py (71%)
rename examples/{ci => mi}/sd_tool_usage.py (70%)
rename examples/{ci => mi}/solve_math_problems.py (66%)
rename metagpt/actions/{ci => mi}/__init__.py (100%)
rename metagpt/actions/{ci => mi}/ask_review.py (100%)
rename metagpt/actions/{ci => mi}/debug_code.py (98%)
rename metagpt/actions/{ci => mi}/execute_nb_code.py (100%)
rename metagpt/actions/{ci => mi}/ml_action.py (93%)
rename metagpt/actions/{ci => mi}/write_analysis_code.py (99%)
rename metagpt/actions/{ci => mi}/write_plan.py (98%)
rename metagpt/prompts/{ci => mi}/__init__.py (100%)
rename metagpt/prompts/{ci => mi}/ml_action.py (100%)
rename metagpt/prompts/{ci => mi}/write_analysis_code.py (100%)
rename metagpt/roles/{ci => mi}/__init__.py (100%)
rename metagpt/roles/{ci/code_interpreter.py => mi/interpreter.py} (91%)
rename metagpt/roles/{ci => mi}/ml_engineer.py (89%)
rename tests/metagpt/actions/{ci => mi}/test_ask_review.py (84%)
rename tests/metagpt/actions/{ci => mi}/test_debug_code.py (96%)
rename tests/metagpt/actions/{ci => mi}/test_execute_nb_code.py (98%)
rename tests/metagpt/actions/{ci => mi}/test_ml_action.py (95%)
rename tests/metagpt/actions/{ci => mi}/test_write_analysis_code.py (99%)
rename tests/metagpt/actions/{ci => mi}/test_write_plan.py (95%)
rename tests/metagpt/roles/{ci/test_code_interpreter.py => mi/test_interpreter.py} (59%)
rename tests/metagpt/roles/{ci => mi}/test_ml_engineer.py (91%)
diff --git a/README.md b/README.md
index d3a035abe..a1aa5ded8 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ # MetaGPT: The Multi-Agent Framework
## News
-🚀 Feb. 08, 2024: [v0.7.0](https://github.com/geekan/MetaGPT/releases/tag/v0.7.0) released, supporting assigning different LLMs to different Roles. We also introduced CodeInterpreter, a powerful agent capable of solving a wide range of real-world problems.
+🚀 Feb. 08, 2024: [v0.7.0](https://github.com/geekan/MetaGPT/releases/tag/v0.7.0) released, supporting assigning different LLMs to different Roles. We also introduced [Interpreter](https://github.com/geekan/MetaGPT/blob/main/examples/mi/README.md), a powerful agent capable of solving a wide range of real-world problems.
🚀 Jan. 16, 2024: Our paper [MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework
](https://arxiv.org/abs/2308.00352) accepted for oral presentation **(top 1.2%)** at ICLR 2024, **ranking #1** in the LLM-based Agent category.
diff --git a/examples/ci/README.md b/examples/ci/README.md
deleted file mode 100644
index d526b94c7..000000000
--- a/examples/ci/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Code Interpreter (CI)
-
-## What is CodeInterpreter
-CodeInterpreter is an agent who solves problems through codes. It understands user requirements, makes plans, writes codes for execution, and uses tools if necessary. These capabilities enable it to tackle a wide range of scenarios, please check out the examples below.
-
-## Example List
-- Data visualization
-- Machine learning modeling
-- Image background removal
-- Solve math problems
-- Receipt OCR
-- Tool usage: web page imitation
-- Tool usage: web crawling
-- Tool usage: text2image
-- Tool usage: email summarization and response
-- More on the way!
-
-Please see [here](https://docs.deepwisdom.ai/main/en/guide/use_cases/agent/code_interpreter/ci_intro.html) for detailed explanation.
\ No newline at end of file
diff --git a/examples/mi/README.md b/examples/mi/README.md
new file mode 100644
index 000000000..1734ba388
--- /dev/null
+++ b/examples/mi/README.md
@@ -0,0 +1,18 @@
+# MetaGPT Interpreter (MI)
+
+## What is Interpreter
+Interpreter is an agent who solves problems through codes. It understands user requirements, makes plans, writes codes for execution, and uses tools if necessary. These capabilities enable it to tackle a wide range of scenarios, please check out the examples below.
+
+## Example List
+- Data visualization
+- Machine learning modeling
+- Image background removal
+- Solve math problems
+- Receipt OCR
+- Tool usage: web page imitation
+- Tool usage: web crawling
+- Tool usage: text2image
+- Tool usage: email summarization and response
+- More on the way!
+
+Please see [here](https://docs.deepwisdom.ai/main/en/guide/use_cases/agent/interpreter/mi_intro.html) for detailed explanation.
\ No newline at end of file
diff --git a/examples/ci/crawl_webpage.py b/examples/mi/crawl_webpage.py
similarity index 76%
rename from examples/ci/crawl_webpage.py
rename to examples/mi/crawl_webpage.py
index 2db9e407b..b5d2fb3d0 100644
--- a/examples/ci/crawl_webpage.py
+++ b/examples/mi/crawl_webpage.py
@@ -5,15 +5,15 @@
@File : crawl_webpage.py
"""
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main():
prompt = """Get data from `paperlist` table in https://papercopilot.com/statistics/iclr-statistics/iclr-2024-statistics/,
and save it to a csv file. paper title must include `multiagent` or `large language model`. *notice: print key variables*"""
- ci = CodeInterpreter(goal=prompt, use_tools=True)
+ mi = Interpreter(use_tools=True)
- await ci.run(prompt)
+ await mi.run(prompt)
if __name__ == "__main__":
diff --git a/examples/ci/data_visualization.py b/examples/mi/data_visualization.py
similarity index 55%
rename from examples/ci/data_visualization.py
rename to examples/mi/data_visualization.py
index 8dc4340d4..2e4acc9b4 100644
--- a/examples/ci/data_visualization.py
+++ b/examples/mi/data_visualization.py
@@ -1,11 +1,11 @@
import asyncio
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main(requirement: str = ""):
- code_interpreter = CodeInterpreter(use_tools=False)
- await code_interpreter.run(requirement)
+ mi = Interpreter(use_tools=False)
+ await mi.run(requirement)
if __name__ == "__main__":
diff --git a/examples/ci/email_summary.py b/examples/mi/email_summary.py
similarity index 90%
rename from examples/ci/email_summary.py
rename to examples/mi/email_summary.py
index d6fa283ca..e1511c5b0 100644
--- a/examples/ci/email_summary.py
+++ b/examples/mi/email_summary.py
@@ -6,7 +6,7 @@
"""
import os
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main():
@@ -22,9 +22,9 @@ async def main():
Firstly, Please help me fetch the latest 5 senders and full letter contents.
Then, summarize each of the 5 emails into one sentence (you can do this by yourself, no need to import other models to do this) and output them in a markdown format."""
- ci = CodeInterpreter(use_tools=True)
+ mi = Interpreter(use_tools=True)
- await ci.run(prompt)
+ await mi.run(prompt)
if __name__ == "__main__":
diff --git a/examples/ci/imitate_webpage.py b/examples/mi/imitate_webpage.py
similarity index 81%
rename from examples/ci/imitate_webpage.py
rename to examples/mi/imitate_webpage.py
index 6a83d3a33..0e9ca731d 100644
--- a/examples/ci/imitate_webpage.py
+++ b/examples/mi/imitate_webpage.py
@@ -5,7 +5,7 @@
@Author : mannaandpoem
@File : imitate_webpage.py
"""
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main():
@@ -15,9 +15,9 @@ Firstly, utilize Selenium and WebDriver for rendering.
Secondly, convert image to a webpage including HTML, CSS and JS in one go.
Finally, save webpage in a text file.
Note: All required dependencies and environments have been fully installed and configured."""
- ci = CodeInterpreter(use_tools=True)
+ mi = Interpreter(use_tools=True)
- await ci.run(prompt)
+ await mi.run(prompt)
if __name__ == "__main__":
diff --git a/examples/ci/machine_learning.py b/examples/mi/machine_learning.py
similarity index 66%
rename from examples/ci/machine_learning.py
rename to examples/mi/machine_learning.py
index 9eda981ac..ee3b47f26 100644
--- a/examples/ci/machine_learning.py
+++ b/examples/mi/machine_learning.py
@@ -1,11 +1,11 @@
import asyncio
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main(requirement: str):
- role = CodeInterpreter(auto_run=True, use_tools=False)
- await role.run(requirement)
+ mi = Interpreter(auto_run=True, use_tools=False)
+ await mi.run(requirement)
if __name__ == "__main__":
diff --git a/examples/ci/ml_engineer_with_tools.py b/examples/mi/ml_engineer_with_tools.py
similarity index 94%
rename from examples/ci/ml_engineer_with_tools.py
rename to examples/mi/ml_engineer_with_tools.py
index 66d37316b..9d0e7f951 100644
--- a/examples/ci/ml_engineer_with_tools.py
+++ b/examples/mi/ml_engineer_with_tools.py
@@ -1,6 +1,6 @@
import asyncio
-from metagpt.roles.ci.ml_engineer import MLEngineer
+from metagpt.roles.mi.ml_engineer import MLEngineer
async def main(requirement: str):
diff --git a/examples/ci/ocr_receipt.py b/examples/mi/ocr_receipt.py
similarity index 72%
rename from examples/ci/ocr_receipt.py
rename to examples/mi/ocr_receipt.py
index dc2db2d01..ffa5cff05 100644
--- a/examples/ci/ocr_receipt.py
+++ b/examples/mi/ocr_receipt.py
@@ -1,16 +1,16 @@
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main():
# Notice: pip install metagpt[ocr] before using this example
image_path = "image.jpg"
language = "English"
- requirement = f"""This is a {language} invoice image.
+ requirement = f"""This is a {language} receipt image.
Your goal is to perform OCR on images using PaddleOCR, then extract the total amount from ocr text results, and finally save as table. Image path: {image_path}.
NOTE: The environments for Paddle and PaddleOCR are all ready and has been fully installed."""
- ci = CodeInterpreter()
+ mi = Interpreter()
- await ci.run(requirement)
+ await mi.run(requirement)
if __name__ == "__main__":
diff --git a/examples/ci/rm_image_background.py b/examples/mi/rm_image_background.py
similarity index 71%
rename from examples/ci/rm_image_background.py
rename to examples/mi/rm_image_background.py
index 83dbbdc77..57e89b103 100644
--- a/examples/ci/rm_image_background.py
+++ b/examples/mi/rm_image_background.py
@@ -1,11 +1,11 @@
import asyncio
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main(requirement: str = ""):
- code_interpreter = CodeInterpreter(use_tools=False)
- await code_interpreter.run(requirement)
+ mi = Interpreter(use_tools=False)
+ await mi.run(requirement)
if __name__ == "__main__":
diff --git a/examples/ci/sd_tool_usage.py b/examples/mi/sd_tool_usage.py
similarity index 70%
rename from examples/ci/sd_tool_usage.py
rename to examples/mi/sd_tool_usage.py
index b4642af23..f8507a411 100644
--- a/examples/ci/sd_tool_usage.py
+++ b/examples/mi/sd_tool_usage.py
@@ -4,12 +4,12 @@
# @Desc :
import asyncio
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main(requirement: str = ""):
- code_interpreter = CodeInterpreter(use_tools=True, goal=requirement)
- await code_interpreter.run(requirement)
+ mi = Interpreter(use_tools=True, goal=requirement)
+ await mi.run(requirement)
if __name__ == "__main__":
diff --git a/examples/ci/solve_math_problems.py b/examples/mi/solve_math_problems.py
similarity index 66%
rename from examples/ci/solve_math_problems.py
rename to examples/mi/solve_math_problems.py
index 8c660975b..dce2edb00 100644
--- a/examples/ci/solve_math_problems.py
+++ b/examples/mi/solve_math_problems.py
@@ -1,11 +1,11 @@
import asyncio
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
async def main(requirement: str = ""):
- code_interpreter = CodeInterpreter(use_tools=False)
- await code_interpreter.run(requirement)
+ mi = Interpreter(use_tools=False)
+ await mi.run(requirement)
if __name__ == "__main__":
diff --git a/metagpt/actions/__init__.py b/metagpt/actions/__init__.py
index 363b4fd33..19a7c10d5 100644
--- a/metagpt/actions/__init__.py
+++ b/metagpt/actions/__init__.py
@@ -22,9 +22,9 @@ from metagpt.actions.write_code_review import WriteCodeReview
from metagpt.actions.write_prd import WritePRD
from metagpt.actions.write_prd_review import WritePRDReview
from metagpt.actions.write_test import WriteTest
-from metagpt.actions.ci.execute_nb_code import ExecuteNbCode
-from metagpt.actions.ci.write_analysis_code import WriteCodeWithoutTools, WriteCodeWithTools
-from metagpt.actions.ci.write_plan import WritePlan
+from metagpt.actions.mi.execute_nb_code import ExecuteNbCode
+from metagpt.actions.mi.write_analysis_code import WriteCodeWithoutTools, WriteCodeWithTools
+from metagpt.actions.mi.write_plan import WritePlan
class ActionType(Enum):
diff --git a/metagpt/actions/ci/__init__.py b/metagpt/actions/mi/__init__.py
similarity index 100%
rename from metagpt/actions/ci/__init__.py
rename to metagpt/actions/mi/__init__.py
diff --git a/metagpt/actions/ci/ask_review.py b/metagpt/actions/mi/ask_review.py
similarity index 100%
rename from metagpt/actions/ci/ask_review.py
rename to metagpt/actions/mi/ask_review.py
diff --git a/metagpt/actions/ci/debug_code.py b/metagpt/actions/mi/debug_code.py
similarity index 98%
rename from metagpt/actions/ci/debug_code.py
rename to metagpt/actions/mi/debug_code.py
index 4a6617dc6..db3b7a9db 100644
--- a/metagpt/actions/ci/debug_code.py
+++ b/metagpt/actions/mi/debug_code.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from metagpt.actions.ci.write_analysis_code import BaseWriteAnalysisCode
+from metagpt.actions.mi.write_analysis_code import BaseWriteAnalysisCode
from metagpt.logs import logger
from metagpt.schema import Message
from metagpt.utils.common import create_func_call_config
diff --git a/metagpt/actions/ci/execute_nb_code.py b/metagpt/actions/mi/execute_nb_code.py
similarity index 100%
rename from metagpt/actions/ci/execute_nb_code.py
rename to metagpt/actions/mi/execute_nb_code.py
diff --git a/metagpt/actions/ci/ml_action.py b/metagpt/actions/mi/ml_action.py
similarity index 93%
rename from metagpt/actions/ci/ml_action.py
rename to metagpt/actions/mi/ml_action.py
index e18d0fd20..60b2fb547 100644
--- a/metagpt/actions/ci/ml_action.py
+++ b/metagpt/actions/mi/ml_action.py
@@ -3,14 +3,14 @@ from __future__ import annotations
from typing import Tuple
from metagpt.actions import Action
-from metagpt.actions.ci.write_analysis_code import WriteCodeWithTools
-from metagpt.prompts.ci.ml_action import (
+from metagpt.actions.mi.write_analysis_code import WriteCodeWithTools
+from metagpt.prompts.mi.ml_action import (
ML_GENERATE_CODE_PROMPT,
ML_TOOL_USAGE_PROMPT,
PRINT_DATA_COLUMNS,
UPDATE_DATA_COLUMNS,
)
-from metagpt.prompts.ci.write_analysis_code import CODE_GENERATOR_WITH_TOOLS
+from metagpt.prompts.mi.write_analysis_code import CODE_GENERATOR_WITH_TOOLS
from metagpt.schema import Message, Plan
from metagpt.utils.common import create_func_call_config, remove_comments
diff --git a/metagpt/actions/ci/write_analysis_code.py b/metagpt/actions/mi/write_analysis_code.py
similarity index 99%
rename from metagpt/actions/ci/write_analysis_code.py
rename to metagpt/actions/mi/write_analysis_code.py
index 421eb0804..b3d0632b6 100644
--- a/metagpt/actions/ci/write_analysis_code.py
+++ b/metagpt/actions/mi/write_analysis_code.py
@@ -10,7 +10,7 @@ from typing import Tuple
from metagpt.actions import Action
from metagpt.logs import logger
-from metagpt.prompts.ci.write_analysis_code import (
+from metagpt.prompts.mi.write_analysis_code import (
CODE_GENERATOR_WITH_TOOLS,
SELECT_FUNCTION_TOOLS,
TOOL_RECOMMENDATION_PROMPT,
diff --git a/metagpt/actions/ci/write_plan.py b/metagpt/actions/mi/write_plan.py
similarity index 98%
rename from metagpt/actions/ci/write_plan.py
rename to metagpt/actions/mi/write_plan.py
index dd9363260..8067d7b87 100644
--- a/metagpt/actions/ci/write_plan.py
+++ b/metagpt/actions/mi/write_plan.py
@@ -12,7 +12,7 @@ from typing import Tuple
from metagpt.actions import Action
from metagpt.logs import logger
-from metagpt.prompts.ci.write_analysis_code import (
+from metagpt.prompts.mi.write_analysis_code import (
ASSIGN_TASK_TYPE_CONFIG,
ASSIGN_TASK_TYPE_PROMPT,
)
diff --git a/metagpt/prompts/ci/__init__.py b/metagpt/prompts/mi/__init__.py
similarity index 100%
rename from metagpt/prompts/ci/__init__.py
rename to metagpt/prompts/mi/__init__.py
diff --git a/metagpt/prompts/ci/ml_action.py b/metagpt/prompts/mi/ml_action.py
similarity index 100%
rename from metagpt/prompts/ci/ml_action.py
rename to metagpt/prompts/mi/ml_action.py
diff --git a/metagpt/prompts/ci/write_analysis_code.py b/metagpt/prompts/mi/write_analysis_code.py
similarity index 100%
rename from metagpt/prompts/ci/write_analysis_code.py
rename to metagpt/prompts/mi/write_analysis_code.py
diff --git a/metagpt/roles/ci/__init__.py b/metagpt/roles/mi/__init__.py
similarity index 100%
rename from metagpt/roles/ci/__init__.py
rename to metagpt/roles/mi/__init__.py
diff --git a/metagpt/roles/ci/code_interpreter.py b/metagpt/roles/mi/interpreter.py
similarity index 91%
rename from metagpt/roles/ci/code_interpreter.py
rename to metagpt/roles/mi/interpreter.py
index 404c93b81..fa50098e9 100644
--- a/metagpt/roles/ci/code_interpreter.py
+++ b/metagpt/roles/mi/interpreter.py
@@ -2,9 +2,9 @@ from __future__ import annotations
from pydantic import Field
-from metagpt.actions.ci.ask_review import ReviewConst
-from metagpt.actions.ci.execute_nb_code import ExecuteNbCode
-from metagpt.actions.ci.write_analysis_code import (
+from metagpt.actions.mi.ask_review import ReviewConst
+from metagpt.actions.mi.execute_nb_code import ExecuteNbCode
+from metagpt.actions.mi.write_analysis_code import (
WriteCodeWithoutTools,
WriteCodeWithTools,
)
@@ -13,9 +13,9 @@ from metagpt.roles import Role
from metagpt.schema import Message, Task, TaskResult
-class CodeInterpreter(Role):
- name: str = "Charlie"
- profile: str = "CodeInterpreter"
+class Interpreter(Role):
+ name: str = "Ivy"
+ profile: str = "Interpreter"
auto_run: bool = True
use_tools: bool = False
execute_code: ExecuteNbCode = Field(default_factory=ExecuteNbCode, exclude=True)
diff --git a/metagpt/roles/ci/ml_engineer.py b/metagpt/roles/mi/ml_engineer.py
similarity index 89%
rename from metagpt/roles/ci/ml_engineer.py
rename to metagpt/roles/mi/ml_engineer.py
index f8bcb2c89..78d605d3e 100644
--- a/metagpt/roles/ci/ml_engineer.py
+++ b/metagpt/roles/mi/ml_engineer.py
@@ -1,13 +1,13 @@
-from metagpt.actions.ci.debug_code import DebugCode
-from metagpt.actions.ci.execute_nb_code import ExecuteNbCode
-from metagpt.actions.ci.ml_action import UpdateDataColumns, WriteCodeWithToolsML
+from metagpt.actions.mi.debug_code import DebugCode
+from metagpt.actions.mi.execute_nb_code import ExecuteNbCode
+from metagpt.actions.mi.ml_action import UpdateDataColumns, WriteCodeWithToolsML
from metagpt.logs import logger
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
from metagpt.tools.tool_type import ToolType
from metagpt.utils.common import any_to_str
-class MLEngineer(CodeInterpreter):
+class MLEngineer(Interpreter):
name: str = "Mark"
profile: str = "MLEngineer"
debug_context: list = []
diff --git a/metagpt/strategy/planner.py b/metagpt/strategy/planner.py
index fd635df39..851d45893 100644
--- a/metagpt/strategy/planner.py
+++ b/metagpt/strategy/planner.py
@@ -4,8 +4,8 @@ import json
from pydantic import BaseModel, Field
-from metagpt.actions.ci.ask_review import AskReview, ReviewConst
-from metagpt.actions.ci.write_plan import (
+from metagpt.actions.mi.ask_review import AskReview, ReviewConst
+from metagpt.actions.mi.write_plan import (
WritePlan,
precheck_update_plan_from_rsp,
update_plan_from_rsp,
diff --git a/metagpt/strategy/solver.py b/metagpt/strategy/solver.py
index e7d61a881..ab16d82bd 100644
--- a/metagpt/strategy/solver.py
+++ b/metagpt/strategy/solver.py
@@ -49,8 +49,8 @@ class TOTSolver(BaseSolver):
raise NotImplementedError
-class CodeInterpreterSolver(BaseSolver):
- """CodeInterpreterSolver: Write&Run code in the graph"""
+class InterpreterSolver(BaseSolver):
+ """InterpreterSolver: Write&Run code in the graph"""
async def solve(self):
raise NotImplementedError
diff --git a/tests/metagpt/actions/ci/test_ask_review.py b/tests/metagpt/actions/mi/test_ask_review.py
similarity index 84%
rename from tests/metagpt/actions/ci/test_ask_review.py
rename to tests/metagpt/actions/mi/test_ask_review.py
index 4f02fe10b..92e8bd046 100644
--- a/tests/metagpt/actions/ci/test_ask_review.py
+++ b/tests/metagpt/actions/mi/test_ask_review.py
@@ -1,6 +1,6 @@
import pytest
-from metagpt.actions.ci.ask_review import AskReview
+from metagpt.actions.mi.ask_review import AskReview
@pytest.mark.asyncio
diff --git a/tests/metagpt/actions/ci/test_debug_code.py b/tests/metagpt/actions/mi/test_debug_code.py
similarity index 96%
rename from tests/metagpt/actions/ci/test_debug_code.py
rename to tests/metagpt/actions/mi/test_debug_code.py
index 0307ac17e..24cfcef10 100644
--- a/tests/metagpt/actions/ci/test_debug_code.py
+++ b/tests/metagpt/actions/mi/test_debug_code.py
@@ -5,7 +5,7 @@
import pytest
-from metagpt.actions.ci.debug_code import DebugCode
+from metagpt.actions.mi.debug_code import DebugCode
from metagpt.schema import Message
ErrorStr = """Tested passed:
diff --git a/tests/metagpt/actions/ci/test_execute_nb_code.py b/tests/metagpt/actions/mi/test_execute_nb_code.py
similarity index 98%
rename from tests/metagpt/actions/ci/test_execute_nb_code.py
rename to tests/metagpt/actions/mi/test_execute_nb_code.py
index 72a85dd08..59a814054 100644
--- a/tests/metagpt/actions/ci/test_execute_nb_code.py
+++ b/tests/metagpt/actions/mi/test_execute_nb_code.py
@@ -1,6 +1,6 @@
import pytest
-from metagpt.actions.ci.execute_nb_code import ExecuteNbCode, truncate
+from metagpt.actions.mi.execute_nb_code import ExecuteNbCode, truncate
@pytest.mark.asyncio
diff --git a/tests/metagpt/actions/ci/test_ml_action.py b/tests/metagpt/actions/mi/test_ml_action.py
similarity index 95%
rename from tests/metagpt/actions/ci/test_ml_action.py
rename to tests/metagpt/actions/mi/test_ml_action.py
index 5d9507094..27d47b0e3 100644
--- a/tests/metagpt/actions/ci/test_ml_action.py
+++ b/tests/metagpt/actions/mi/test_ml_action.py
@@ -1,6 +1,6 @@
import pytest
-from metagpt.actions.ci.ml_action import WriteCodeWithToolsML
+from metagpt.actions.mi.ml_action import WriteCodeWithToolsML
from metagpt.schema import Plan, Task
diff --git a/tests/metagpt/actions/ci/test_write_analysis_code.py b/tests/metagpt/actions/mi/test_write_analysis_code.py
similarity index 99%
rename from tests/metagpt/actions/ci/test_write_analysis_code.py
rename to tests/metagpt/actions/mi/test_write_analysis_code.py
index 95c7dfca8..6c2228222 100644
--- a/tests/metagpt/actions/ci/test_write_analysis_code.py
+++ b/tests/metagpt/actions/mi/test_write_analysis_code.py
@@ -2,8 +2,8 @@ import asyncio
import pytest
-from metagpt.actions.ci.execute_nb_code import ExecuteNbCode
-from metagpt.actions.ci.write_analysis_code import (
+from metagpt.actions.mi.execute_nb_code import ExecuteNbCode
+from metagpt.actions.mi.write_analysis_code import (
WriteCodeWithoutTools,
WriteCodeWithTools,
)
diff --git a/tests/metagpt/actions/ci/test_write_plan.py b/tests/metagpt/actions/mi/test_write_plan.py
similarity index 95%
rename from tests/metagpt/actions/ci/test_write_plan.py
rename to tests/metagpt/actions/mi/test_write_plan.py
index 3eb80ca3e..97632ea44 100644
--- a/tests/metagpt/actions/ci/test_write_plan.py
+++ b/tests/metagpt/actions/mi/test_write_plan.py
@@ -1,6 +1,6 @@
import pytest
-from metagpt.actions.ci.write_plan import (
+from metagpt.actions.mi.write_plan import (
Plan,
Task,
WritePlan,
diff --git a/tests/metagpt/roles/ci/test_code_interpreter.py b/tests/metagpt/roles/mi/test_interpreter.py
similarity index 59%
rename from tests/metagpt/roles/ci/test_code_interpreter.py
rename to tests/metagpt/roles/mi/test_interpreter.py
index 9d2f2429b..3bae4a1ac 100644
--- a/tests/metagpt/roles/ci/test_code_interpreter.py
+++ b/tests/metagpt/roles/mi/test_interpreter.py
@@ -1,23 +1,23 @@
import pytest
from metagpt.logs import logger
-from metagpt.roles.ci.code_interpreter import CodeInterpreter
+from metagpt.roles.mi.interpreter import Interpreter
@pytest.mark.asyncio
@pytest.mark.parametrize("auto_run", [(True), (False)])
-async def test_code_interpreter(mocker, auto_run):
- mocker.patch("metagpt.actions.ci.execute_nb_code.ExecuteNbCode.run", return_value=("a successful run", True))
+async def test_interpreter(mocker, auto_run):
+ mocker.patch("metagpt.actions.mi.execute_nb_code.ExecuteNbCode.run", return_value=("a successful run", True))
mocker.patch("builtins.input", return_value="confirm")
requirement = "Run data analysis on sklearn Iris dataset, include a plot"
tools = []
- ci = CodeInterpreter(auto_run=auto_run, use_tools=True, tools=tools)
- rsp = await ci.run(requirement)
+ mi = Interpreter(auto_run=auto_run, use_tools=True, tools=tools)
+ rsp = await mi.run(requirement)
logger.info(rsp)
assert len(rsp.content) > 0
- finished_tasks = ci.planner.plan.get_finished_tasks()
+ finished_tasks = mi.planner.plan.get_finished_tasks()
assert len(finished_tasks) > 0
assert len(finished_tasks[0].code) > 0 # check one task to see if code is recorded
diff --git a/tests/metagpt/roles/ci/test_ml_engineer.py b/tests/metagpt/roles/mi/test_ml_engineer.py
similarity index 91%
rename from tests/metagpt/roles/ci/test_ml_engineer.py
rename to tests/metagpt/roles/mi/test_ml_engineer.py
index 3bf9f3b92..921ac8822 100644
--- a/tests/metagpt/roles/ci/test_ml_engineer.py
+++ b/tests/metagpt/roles/mi/test_ml_engineer.py
@@ -1,16 +1,16 @@
import pytest
-from metagpt.actions.ci.execute_nb_code import ExecuteNbCode
+from metagpt.actions.mi.execute_nb_code import ExecuteNbCode
from metagpt.logs import logger
-from metagpt.roles.ci.ml_engineer import MLEngineer
+from metagpt.roles.mi.ml_engineer import MLEngineer
from metagpt.schema import Message, Plan, Task
from metagpt.tools.tool_type import ToolType
-from tests.metagpt.actions.ci.test_debug_code import CODE, DebugContext, ErrorStr
+from tests.metagpt.actions.mi.test_debug_code import CODE, DebugContext, ErrorStr
def test_mle_init():
- ci = MLEngineer(goal="test", auto_run=True, use_tools=True, tools=["tool1", "tool2"])
- assert ci.tools == []
+ mle = MLEngineer(goal="test", auto_run=True, use_tools=True, tools=["tool1", "tool2"])
+ assert mle.tools == []
MockPlan = Plan(
diff --git a/tests/metagpt/utils/test_save_code.py b/tests/metagpt/utils/test_save_code.py
index 35ad84baf..9df2650f3 100644
--- a/tests/metagpt/utils/test_save_code.py
+++ b/tests/metagpt/utils/test_save_code.py
@@ -6,7 +6,7 @@
import nbformat
import pytest
-from metagpt.actions.ci.execute_nb_code import ExecuteNbCode
+from metagpt.actions.mi.execute_nb_code import ExecuteNbCode
from metagpt.utils.common import read_json_file
from metagpt.utils.save_code import DATA_PATH, save_code_file
From 10553b22080c674bdeb82987dcefa79c4fc9ec28 Mon Sep 17 00:00:00 2001
From: yzlin
Date: Sun, 18 Feb 2024 19:00:05 +0800
Subject: [PATCH 2/2] release v0.7.1
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index be3956ea4..4efcebdc1 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.1",
description="The Multi-Agent Framework",
long_description=long_description,
long_description_content_type="text/markdown",