rename interpreter

This commit is contained in:
yzlin 2024-03-01 18:33:49 +08:00
parent 45dd352bf0
commit 08bf756ae8
39 changed files with 90 additions and 88 deletions

18
examples/di/README.md Normal file
View file

@ -0,0 +1,18 @@
# Data Interpreter (DI)
## What is Data Interpreter
Data 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/intro.html) for detailed explanation.

View file

@ -5,15 +5,15 @@
@File : crawl_webpage.py
"""
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
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*"""
mi = Interpreter(use_tools=True)
di = DataInterpreter(use_tools=True)
await mi.run(prompt)
await di.run(prompt)
if __name__ == "__main__":

View file

@ -1,11 +1,11 @@
import asyncio
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str = ""):
mi = Interpreter(use_tools=False)
await mi.run(requirement)
di = DataInterpreter(use_tools=False)
await di.run(requirement)
if __name__ == "__main__":

View file

@ -6,7 +6,7 @@
"""
import os
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
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."""
mi = Interpreter(use_tools=True)
di = DataInterpreter(use_tools=True)
await mi.run(prompt)
await di.run(prompt)
if __name__ == "__main__":

View file

@ -5,7 +5,7 @@
@Author : mannaandpoem
@File : imitate_webpage.py
"""
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
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."""
mi = Interpreter(use_tools=True)
di = DataInterpreter(use_tools=True)
await mi.run(prompt)
await di.run(prompt)
if __name__ == "__main__":

View file

@ -1,12 +1,12 @@
import fire
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
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)
di = DataInterpreter(auto_run=auto_run)
await di.run(requirement)
if __name__ == "__main__":

View file

@ -1,6 +1,6 @@
import asyncio
from metagpt.roles.mi.ml_engineer import MLEngineer
from metagpt.roles.di.ml_engineer import MLEngineer
async def main(requirement: str):

View file

@ -1,4 +1,4 @@
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main():
@ -8,9 +8,9 @@ async def main():
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."""
mi = Interpreter()
di = DataInterpreter()
await mi.run(requirement)
await di.run(requirement)
if __name__ == "__main__":

View file

@ -1,11 +1,11 @@
import asyncio
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str = ""):
mi = Interpreter(use_tools=False)
await mi.run(requirement)
di = DataInterpreter(use_tools=False)
await di.run(requirement)
if __name__ == "__main__":

View file

@ -4,12 +4,12 @@
# @Desc :
import asyncio
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str = ""):
mi = Interpreter(use_tools=True, goal=requirement)
await mi.run(requirement)
di = DataInterpreter(use_tools=True, goal=requirement)
await di.run(requirement)
if __name__ == "__main__":

View file

@ -1,11 +1,11 @@
import asyncio
from metagpt.roles.mi.interpreter import Interpreter
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str = ""):
mi = Interpreter(use_tools=False)
await mi.run(requirement)
di = DataInterpreter(use_tools=False)
await di.run(requirement)
if __name__ == "__main__":

View file

@ -1,18 +0,0 @@
# 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.