ð The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
MetaGPT: ãã«ããšãŒãžã§ã³ããã¬ãŒã ã¯ãŒã¯
[ En | äž | Fr | æ¥ ] GPT ã«ããŸããŸãªåœ¹å²ãå²ãåœãŠãããšã§ãè€éãªã¿ã¹ã¯ã®ããã®å ±åãœãããŠã§ã¢ãšã³ãã£ãã£ã圢æããŸãã
- MetaGPT ã¯ã1 è¡ã®èŠä»¶ ãå ¥åãšãããŠãŒã¶ãŒã¹ããŒãªãŒ / ç«¶ååæ / èŠä»¶ / ããŒã¿æ§é / API / ææžãªã© ãåºåããŸãã
- MetaGPT ã«ã¯ããããã¯ã ãããŒãžã£ãŒãã¢ãŒããã¯ãããããžã§ã¯ã ãããŒãžã£ãŒããšã³ãžã㢠ãå«ãŸããŠããŸããMetaGPT ã¯ããœãããŠã§ã¢äŒç€Ÿã®ããã»ã¹å
šäœããæ
éã«èª¿æŽããã SOP ãšãšãã«æäŸããŸãã
Code = SOP(Team)ãåºæ¬ç念ã§ããç§ãã¡ã¯ SOP ãå ·äœåããLLM ã§æ§æãããããŒã ã«é©çšããŸãã

ãœãããŠã§ã¢äŒç€Ÿã®ãã«ãããŒã«å³åŒïŒé 次å°å ¥ïŒ
MetaGPT ã®èœå
https://github.com/user-attachments/assets/888cb169-78c3-4a42-9d62-9d90ed3928c9
äŸïŒGPT-4 ã§å®å šçæïŒ
äŸãã°ãmetagpt "Toutiao ã®ãã㪠RecSys ããã¶ã€ã³ãã"ãšå
¥åãããšãå€ãã®åºåãåŸãããŸã

è§£æãšèšèšãå«ã 1 ã€ã®äŸãçæããã®ã«çŽ $0.2ïŒGPT-4 ã® API äœ¿çšæïŒãå®å šãªãããžã§ã¯ãã§ã¯çŽ $2.0 ããããŸãã
ã€ã³ã¹ããŒã«
ã€ã³ã¹ããŒã«ãããªã¬ã€ã
äŒçµ±çãªã€ã³ã¹ããŒã«
Python 3.9 以äžãã·ã¹ãã ã«ã€ã³ã¹ããŒã«ãããŠããããšã確èªããŠãã ãããããã¯
python --versionã䜿ã£ãŠãã§ãã¯ã§ããŸãã
以äžã®ããã«condaã䜿ãããšãã§ããŸãïŒconda create -n metagpt python=3.9 && conda activate metagpt
pip install metagpt
metagpt --init-config # ~/.metagpt/config2.yaml ãäœæããèªåã®èšå®ã«åãããŠå€æŽããŠãã ãã
metagpt "2048ã²ãŒã ãäœæãã" # ããã«ãã ./workspace ã«ãªããžããªãäœæãããŸã
ãŸãã¯ãã©ã€ãã©ãªãšããŠäœ¿çšããããšãã§ããŸã
from metagpt.software_company import generate_repo, ProjectRepo
repo: ProjectRepo = generate_repo("2048ã²ãŒã ãäœæãã") # ãŸã㯠ProjectRepo("<ãã¹>")
print(repo) # ãªããžããªã®æ§é ãšãã¡ã€ã«ãåºåããŸã
泚:
ãã§ã« ChromeãChromiumãMS Edge ãã€ã³ã¹ããŒã«ãããŠããå Žåã¯ãç°å¢å€æ°
PUPPETEER_SKIP_CHROMIUM_DOWNLOADãtrueã«èšå®ããããšã§ã Chromium ã®ããŠã³ããŒããã¹ãããããããšãã§ããŸãããã®ããŒã«ãã°ããŒãã«ã«ã€ã³ã¹ããŒã«ããåé¡ãæ±ããŠãã人ãããŸããããŒã«ã«ã«ã€ã³ã¹ããŒã«ããã®ã代æ¿ã®è§£æ±ºçã§ãã
npm install @mermaid-js/mermaid-cliconfig.yml ã« mmdc ã®ã³ã³ãã£ã°ãèšè¿°ããã®ãå¿ããªãããš
puppeteer_config: "./config/puppeteer-config.json" path: "./node_modules/.bin/mmdc"ãã
pip install -e.ããšã©ãŒ[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'ã§å€±æãããã代ããã«pip install -e. --userãå®è¡ããŠã¿ãŠãã ããMermaid charts ã SVGãPNGãPDF 圢åŒã«å€æããŸããNode.js çã® Mermaid-CLI ã«å ããŠãPython çã® PlaywrightãpyppeteerããŸã㯠mermaid.ink ããã®ã¿ã¹ã¯ã«äœ¿çšã§ããããã«ãªããŸããã
Playwright
- Playwright ã®ã€ã³ã¹ããŒã«
pip install playwright- å¿ èŠãªãã©ãŠã¶ã®ã€ã³ã¹ããŒã«
PDF倿ããµããŒãããã«ã¯ãChrominumãã€ã³ã¹ããŒã«ããŠãã ããã
playwright install --with-deps chromium- modify
config2.yaml
config2.yaml ãã mermaid.engine ã®ã³ã¡ã³ããå€ãã
playwrightã«å€æŽããmermaid: engine: playwrightpyppeteer
- pyppeteer ã®ã€ã³ã¹ããŒã«
pip install pyppeteer- èªåã®ãã©ãŠã¶ã䜿çš
pyppeteer ã䜿ãã°ã€ã³ã¹ããŒã«ãããŠãããã©ãŠã¶ã䜿ãããšãã§ããŸãã以äžã®ç°å¢ãèšå®ããŠãã ãã
export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chromeãã©ãŠã¶ã®ã€ã³ã¹ããŒã«ã«ãã®ã³ãã³ãã䜿ããªãã§ãã ãããããã¯å€ãããŸã
pyppeteer-installconfig2.yamlãä¿®æ£
config2.yaml ãã mermaid.engine ã®ã³ã¡ã³ããå€ãã
pyppeteerã«å€æŽããmermaid: engine: pyppeteermermaid.ink
config2.yamlãä¿®æ£
config2.yaml ãã mermaid.engine ã®ã³ã¡ã³ããå€ãã
inkã«å€æŽããmermaid: engine: ink泚: ãã®æ¹æ³ã¯ pdf ãšã¯ã¹ããŒãã«å¯Ÿå¿ããŠããŸããã
Docker ã«ããã€ã³ã¹ããŒã«
Windowsã§ã¯ã"/opt/metagpt"ãDockerãäœæããæš©éãæã€ãã£ã¬ã¯ããªã«çœ®ãæããå¿ èŠããããŸããäŸãã°ã"D:\Users\x\metagpt"ãªã©ã§ãã
# ã¹ããã 1: metagpt å
¬åŒã€ã¡ãŒãžãããŠã³ããŒãããconfig2.yaml ãæºåãã
docker pull metagpt/metagpt:latest
mkdir -p /opt/metagpt/{config,workspace}
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config2.yaml > /opt/metagpt/config/config2.yaml
vim /opt/metagpt/config/config2.yaml # èšå®ã倿Žãã
# ã¹ããã 2: ã³ã³ããã§ metagpt ãã¢ãå®è¡ãã
docker run --rm \
--privileged \
-v /opt/metagpt/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
metagpt "Write a cli snake game"
# ã³ã³ãããèµ·åãããã®äžã§ã³ãã³ããå®è¡ããããšãã§ããŸã
docker run --name metagpt -d \
--privileged \
-v /opt/metagpt/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest
docker exec -it metagpt /bin/bash
$ metagpt "Write a cli snake game"
ã³ãã³ã docker run ... ã¯ä»¥äžã®ããšãè¡ããŸã:
- ç¹æš©ã¢ãŒãã§å®è¡ãããã©ãŠã¶ã®å®è¡æš©éãåŸã
- ãã¹ãèšå®ãã¡ã€ã«
/opt/metagpt/config/config2.yamlãã³ã³ãã/app/metagpt/config/config2.yamlã«ãããããŸã - ãã¹ããã£ã¬ã¯ããª
/opt/metagpt/workspaceãã³ã³ãããã£ã¬ã¯ããª/app/metagpt/workspaceã«ãããããs - ãã¢ã³ãã³ã
metagpt "Write a cli snake game"ãå®è¡ãã
èªåã§ã€ã¡ãŒãžããã«ããã
# ãŸããèªåã§ metagpt ã€ã¡ãŒãžãæ§ç¯ããããšãã§ããŸãã
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT && docker build -t metagpt:custom .
èšå®
api_keyã~/.metagpt/config2.yaml / config/config2.yamlã®ããããã§èšå®ããŸãã- åªå
é äœã¯:
~/.metagpt/config2.yaml > config/config2.yaml > envã®é ã§ãã
# èšå®ãã¡ã€ã«ãã³ããŒããå¿
èŠãªä¿®æ£ãå ããã
cp config/config2.yaml ~/.metagpt/config2.yaml
ãã¥ãŒããªã¢ã«: ã¹ã¿ãŒãã¢ããã®éå§
# ã¹ã¯ãªããã®å®è¡
metagpt "Write a cli snake game"
# ãããžã§ã¯ãã®å®æœã«ãšã³ãžãã¢ãéããªãããš
metagpt "Write a cli snake game" --no-implement
# ãšã³ãžãã¢ãéããã³ãŒãã¬ãã¥ãŒãè¡ã
metagpt "Write a cli snake game" --code_review
ã¹ã¯ãªãããå®è¡ãããšãworkspace/ ãã£ã¬ã¯ããªã«æ°ãããããžã§ã¯ããèŠã€ãããŸãã
ãã©ãããã©ãŒã ãŸãã¯ããŒã«ã®èšå®
èŠä»¶ãè¿°ã¹ããšãã«ãã©ã®ãã©ãããã©ãŒã ãŸãã¯ããŒã«ã䜿çšããããæå®ã§ããŸãã
metagpt "pygame ãããŒã¹ãšãã cli ããã²ãŒã ãæžã"
äœ¿çšæ¹æ³
äŒç€Ÿå
metagpt - ç§ãã¡ã¯ AI ã§æ§æããããœãããŠã§ã¢ã»ã¹ã¿ãŒãã¢ããã§ããç§ãã¡ã«æè³ããããšã¯ãç¡éã®å¯èœæ§ã«æºã¡ãæªæ¥ã«åãäžããããšã§ãã
ã·ããã·ã¹
metagpt IDEA <flags>
説æ
ç§ãã¡ã¯ AI ã§æ§æããããœãããŠã§ã¢ã»ã¹ã¿ãŒãã¢ããã§ããç§ãã¡ã«æè³ããããšã¯ãç¡éã®å¯èœæ§ã«æºã¡ãæªæ¥ã«åãäžããããšã§ãã
äœçœ®åŒæ°
IDEA
å: str
ããªãã®é©æ°çãªã¢ã€ãã¢ãäŸãã°"ã¹ããŒã¯ã²ãŒã ãäœãã"ãªã©
ãã©ã°
--investment=INVESTMENT
å: float
ããã©ã«ã: 3.0
æè³å®¶ãšããŠãããªãã¯ãã® AI äŒæ¥ã«äžå®ã®éé¡ãæ åºããæ©äŒãããã
--n_round=N_ROUND
å: int
ããã©ã«ã: 5
泚æäºé
äœçœ®åŒæ°ã«ãã©ã°æ§æã䜿ãããšãã§ããŸã
ã³ãŒããŠã©ãŒã¯ã¹ã«ãŒ
from metagpt.team import Team
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer
async def startup(idea: str, investment: float = 3.0, n_round: int = 5):
"""ã¹ã¿ãŒãã¢ãããå®è¡ããããã¹ã«ãªãã"""
company = Team()
company.hire([ProductManager(), Architect(), ProjectManager(), Engineer()])
company.invest(investment)
company.start_project(idea)
await company.run(n_round=n_round)
examples ã§ã·ã³ã°ã«ã»ããŒã«ïŒãã¬ããžã»ããŒã¹ä»ãïŒãš LLM ã®ã¿ã®äŸã詳ããèŠãããšãã§ããŸãã
ã¯ã€ãã¯ã¹ã¿ãŒã
ããŒã«ã«ç°å¢ã®ã€ã³ã¹ããŒã«ãèšå®ã¯ããŠãŒã¶ãŒã«ãã£ãŠã¯é£ãããã®ã§ãã以äžã®ãã¥ãŒããªã¢ã«ã§ MetaGPT ã®é åãããã«äœéšã§ããŸãã
Hugging Face Space ã§è©Šã
åŒçš
ç ç©¶è«æã§MetaGPTãData Interpreterã䜿çšããå Žåã¯ã以äžã®ããã«åœç€Ÿã®äœæ¥ãåŒçšããŠãã ããïŒ
@inproceedings{hong2024metagpt,
title={Meta{GPT}: Meta Programming for A Multi-Agent Collaborative Framework},
author={Sirui Hong and Mingchen Zhuge and Jonathan Chen and Xiawu Zheng and Yuheng Cheng and Jinlin Wang and Ceyao Zhang and Zili Wang and Steven Ka Shing Yau and Zijuan Lin and Liyang Zhou and Chenyu Ran and Lingfeng Xiao and Chenglin Wu and J{\"u}rgen Schmidhuber},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=VtmBAGCN7o}
}
@misc{hong2024data,
title={Data Interpreter: An LLM Agent For Data Science},
author={Sirui Hong and Yizhang Lin and Bang Liu and Bangbang Liu and Binhao Wu and Danyang Li and Jiaqi Chen and Jiayi Zhang and Jinlin Wang and Li Zhang and Lingyao Zhang and Min Yang and Mingchen Zhuge and Taicheng Guo and Tuo Zhou and Wei Tao and Wenyi Wang and Xiangru Tang and Xiangtao Lu and Xiawu Zheng and Xinbing Liang and Yaying Fei and Yuheng Cheng and Zongze Xu and Chenglin Wu},
year={2024},
eprint={2402.18679},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
ãåãåããå
ãã®ãããžã§ã¯ãã«é¢ããã質åããæèŠãããããŸãããããæ°è»œã«ãåãåãããã ãããçæ§ã®ãæèŠããåŸ ã¡ããŠãããŸãïŒ
- Email: [email protected]
- GitHub Issues: æè¡çãªãåãåããã«ã€ããŠã¯ãGitHub ãªããžããª ã«æ°ãã issue ãäœæããããšãã§ããŸãã
ã質åã«ã¯ 2-3 å¶æ¥æ¥ä»¥å ã«åçããããŸãã
ãã¢
https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d
åå ãã
ð¢ Discord ãã£ã³ãã«ã«åå ããŠãã ããïŒ https://discord.gg/ZRHeExS6xv
ãäŒãã§ããããšã楜ãã¿ã«ããŠããŸãïŒ ð
