From f1bcfc7868db021ad1780bed41b4f04271e1b2c4 Mon Sep 17 00:00:00 2001 From: better629 Date: Fri, 27 Oct 2023 17:06:28 +0800 Subject: [PATCH 01/15] add docs/tutorial --- docs/tutorial/faq.md | 6 +++ docs/tutorial/usage.md | 67 +++++++++++++++++++++++++++++++ docs/tutorial/usage_cn.md | 63 +++++++++++++++++++++++++++++ docs/tutorial/what_can_this_do.md | 0 4 files changed, 136 insertions(+) create mode 100644 docs/tutorial/faq.md create mode 100644 docs/tutorial/usage.md create mode 100644 docs/tutorial/usage_cn.md create mode 100644 docs/tutorial/what_can_this_do.md diff --git a/docs/tutorial/faq.md b/docs/tutorial/faq.md new file mode 100644 index 000000000..0d2fa7ef0 --- /dev/null +++ b/docs/tutorial/faq.md @@ -0,0 +1,6 @@ +## FAQs + +### installation + + +### openai usage diff --git a/docs/tutorial/usage.md b/docs/tutorial/usage.md new file mode 100644 index 000000000..ee87b65c9 --- /dev/null +++ b/docs/tutorial/usage.md @@ -0,0 +1,67 @@ +## MetaGPT Usage + +### Configuration + +- Configure your `OPENAI_API_KEY` in any of `config/key.yaml / config/config.yaml / env` +- Priority order: `config/key.yaml > config/config.yaml > env` + +```bash +# Copy the configuration file and make the necessary modifications. +cp config/config.yaml config/key.yaml +``` + +| Variable Name | config/key.yaml | env | +| ------------------------------------------ | ----------------------------------------- | ----------------------------------------------- | +| OPENAI_API_KEY # Replace with your own key | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." | +| OPENAI_API_BASE # Optional | OPENAI_API_BASE: "https:///v1" | export OPENAI_API_BASE="https:///v1" | + +### Initiating a startup + +```shell +# Run the script +python startup.py "Write a cli snake game" +# Do not hire an engineer to implement the project +python startup.py "Write a cli snake game" --implement False +# Hire an engineer and perform code reviews +python startup.py "Write a cli snake game" --code_review True +``` + +After running the script, you can find your new project in the `workspace/` directory. + +### Preference of Platform or Tool + +You can tell which platform or tool you want to use when stating your requirements. + +```shell +python startup.py "Write a cli snake game based on pygame" +``` + +### Usage + +``` +NAME + startup.py - We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities. + +SYNOPSIS + startup.py IDEA + +DESCRIPTION + We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities. + +POSITIONAL ARGUMENTS + IDEA + Type: str + Your innovative idea, such as "Creating a snake game." + +FLAGS + --investment=INVESTMENT + Type: float + Default: 3.0 + As an investor, you have the opportunity to contribute a certain dollar amount to this AI company. + --n_round=N_ROUND + Type: int + Default: 5 + +NOTES + You can also use flags syntax for POSITIONAL ARGUMENTS +``` \ No newline at end of file diff --git a/docs/tutorial/usage_cn.md b/docs/tutorial/usage_cn.md new file mode 100644 index 000000000..4b3bdd2c3 --- /dev/null +++ b/docs/tutorial/usage_cn.md @@ -0,0 +1,63 @@ +## MetaGPT 使用 + +### 配置 + +- 在 `config/key.yaml / config/config.yaml / env` 中配置您的 `OPENAI_API_KEY` +- 优先级顺序:`config/key.yaml > config/config.yaml > env` + +```bash +# 复制配置文件并进行必要的修改 +cp config/config.yaml config/key.yaml +``` + +| 变量名 | config/key.yaml | env | +| ----------------------------------- | ----------------------------------------- | ----------------------------------------------- | +| OPENAI_API_KEY # 用您自己的密钥替换 | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." | +| OPENAI_API_BASE # 可选 | OPENAI_API_BASE: "https:///v1" | export OPENAI_API_BASE="https:///v1" | + +### 示例:启动一个创业公司 + +```shell +python startup.py "写一个命令行贪吃蛇" +# 开启code review模式会花费更多的金钱, 但是会提升代码质量和成功率 +python startup.py "写一个命令行贪吃蛇" --code_review True +``` + +运行脚本后,您可以在 `workspace/` 目录中找到您的新项目。 + +### 平台或工具的倾向性 +可以在阐述需求时说明想要使用的平台或工具。 +例如: +```shell +python startup.py "写一个基于pygame的命令行贪吃蛇" +``` + +### 使用 + +``` +名称 + startup.py - 我们是一家AI软件创业公司。通过投资我们,您将赋能一个充满无限可能的未来。 + +概要 + startup.py IDEA + +描述 + 我们是一家AI软件创业公司。通过投资我们,您将赋能一个充满无限可能的未来。 + +位置参数 + IDEA + 类型: str + 您的创新想法,例如"写一个命令行贪吃蛇。" + +标志 + --investment=INVESTMENT + 类型: float + 默认值: 3.0 + 作为投资者,您有机会向这家AI公司投入一定的美元金额。 + --n_round=N_ROUND + 类型: int + 默认值: 5 + +备注 + 您也可以用`标志`的语法,来处理`位置参数` +``` diff --git a/docs/tutorial/what_can_this_do.md b/docs/tutorial/what_can_this_do.md new file mode 100644 index 000000000..e69de29bb From 11e720a496cf3d63d19bc6f9a606113b02ecd7cc Mon Sep 17 00:00:00 2001 From: better629 Date: Fri, 27 Oct 2023 17:06:45 +0800 Subject: [PATCH 02/15] add docs/install --- docs/install/cli_install.md | 109 ++++++++++++++++++++++++++++++ docs/install/cli_install_cn.md | 43 ++++++++++++ docs/install/docker_install.md | 44 ++++++++++++ docs/install/docker_install_cn.md | 44 ++++++++++++ 4 files changed, 240 insertions(+) create mode 100644 docs/install/cli_install.md create mode 100644 docs/install/cli_install_cn.md create mode 100644 docs/install/docker_install.md create mode 100644 docs/install/docker_install_cn.md diff --git a/docs/install/cli_install.md b/docs/install/cli_install.md new file mode 100644 index 000000000..19f0e3c75 --- /dev/null +++ b/docs/install/cli_install.md @@ -0,0 +1,109 @@ +## Traditional Command Line Installation + +### Support System and version +| System Version | Python Version | Supported | +| ---- | ---- | ----- | +| macOS 13.x | python 3.9 | Yes | +| Windows 11 | python 3.9 | Yes | +| Ubuntu 22.04 | python 3.9 | Yes | + +### Detail Installation +```bash +# Step 1: Ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) +npm --version +sudo npm install -g @mermaid-js/mermaid-cli + +# Step 2: Ensure that Python 3.9+ is installed on your system. You can check this by using: +python3 --version + +# Step 3: Clone the repository to your local machine, and install it. +git clone https://github.com/geekan/metagpt +cd metagpt +pip install -e. +``` + +**Note:** + +- If already have Chrome, Chromium, or MS Edge installed, you can skip downloading Chromium by setting the environment variable + `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` to `true`. + +- Some people are [having issues](https://github.com/mermaidjs/mermaid.cli/issues/15) installing this tool globally. Installing it locally is an alternative solution, + + ```bash + npm install @mermaid-js/mermaid-cli + ``` + +- don't forget to the configuration for mmdc in config.yml + + ```yml + PUPPETEER_CONFIG: "./config/puppeteer-config.json" + MMDC: "./node_modules/.bin/mmdc" + ``` + +- if `pip install -e.` fails with error `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`, try instead running `pip install -e. --user` + +- To convert Mermaid charts to SVG, PNG, and PDF formats. In addition to the Node.js version of Mermaid-CLI, you now have the option to use Python version Playwright, pyppeteer or mermaid.ink for this task. + + - Playwright + - **Install Playwright** + + ```bash + pip install playwright + ``` + + - **Install the Required Browsers** + + to support PDF conversion, please install Chrominum. + + ```bash + playwright install --with-deps chromium + ``` + + - **modify `config.yaml`** + + uncomment MERMAID_ENGINE from config.yaml and change it to `playwright` + + ```yaml + MERMAID_ENGINE: playwright + ``` + + - pyppeteer + - **Install pyppeteer** + + ```bash + pip install pyppeteer + ``` + + - **Use your own Browsers** + + pyppeteer allows you use installed browsers, please set the following envirment + + ```bash + export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chrome + ``` + + please do not use this command to install browser, it is too old + + ```bash + pyppeteer-install + ``` + + - **modify `config.yaml`** + + uncomment MERMAID_ENGINE from config.yaml and change it to `pyppeteer` + + ```yaml + MERMAID_ENGINE: pyppeteer + ``` + + - mermaid.ink + - **modify `config.yaml`** + + uncomment MERMAID_ENGINE from config.yaml and change it to `ink` + + ```yaml + MERMAID_ENGINE: ink + ``` + + Note: this method does not support pdf export. + \ No newline at end of file diff --git a/docs/install/cli_install_cn.md b/docs/install/cli_install_cn.md new file mode 100644 index 000000000..fe97a0b80 --- /dev/null +++ b/docs/install/cli_install_cn.md @@ -0,0 +1,43 @@ +## 命令行安装 + +### 支持的系统和版本 +| 系统版本 | Python 版本 | 是否支持 | +| ---- | ---- | ----- | +| macOS 13.x | python 3.9 | 是 | +| Windows 11 | python 3.9 | 是 | +| Ubuntu 22.04 | python 3.9 | 是 | + +### 详细安装 + +```bash +# 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js +npm --version +sudo npm install -g @mermaid-js/mermaid-cli + +# 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查: +python --version + +# 第 3 步:克隆仓库到您的本地机器,并进行安装。 +git clone https://github.com/geekan/metagpt +cd metagpt +pip install -e. +``` + +**注意:** + +- 如果已经安装了Chrome、Chromium或MS Edge,可以通过将环境变量`PUPPETEER_SKIP_CHROMIUM_DOWNLOAD`设置为`true`来跳过下载Chromium。 + +- 一些人在全局安装此工具时遇到问题。在本地安装是替代解决方案, + + ```bash + npm install @mermaid-js/mermaid-cli + ``` + +- 不要忘记在config.yml中为mmdc配置配置, + + ```yml + PUPPETEER_CONFIG: "./config/puppeteer-config.json" + MMDC: "./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`运行。 diff --git a/docs/install/docker_install.md b/docs/install/docker_install.md new file mode 100644 index 000000000..b803a5dae --- /dev/null +++ b/docs/install/docker_install.md @@ -0,0 +1,44 @@ +## Docker Installation + +### Use default MetaGPT image + +```bash +# Step 1: Download metagpt official image and prepare config.yaml +docker pull metagpt/metagpt:latest +mkdir -p /opt/metagpt/{config,workspace} +docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml +vim /opt/metagpt/config/key.yaml # Change the config + +# Step 2: Run metagpt demo with container +docker run --rm \ + --privileged \ + -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \ + -v /opt/metagpt/workspace:/app/metagpt/workspace \ + metagpt/metagpt:latest \ + python3 startup.py "Write a cli snake game" + +# You can also start a container and execute commands in it +docker run --name metagpt -d \ + --privileged \ + -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \ + -v /opt/metagpt/workspace:/app/metagpt/workspace \ + metagpt/metagpt:latest + +docker exec -it metagpt /bin/bash +$ python3 startup.py "Write a cli snake game" +``` + +The command `docker run ...` do the following things: + +- Run in privileged mode to have permission to run the browser +- Map host configure file `/opt/metagpt/config/key.yaml` to container `/app/metagpt/config/key.yaml` +- Map host directory `/opt/metagpt/workspace` to container `/app/metagpt/workspace` +- Execute the demo command `python3 startup.py "Write a cli snake game"` + +### Build image by yourself + +```bash +# You can also build metagpt image by yourself. +git clone https://github.com/geekan/MetaGPT.git +cd MetaGPT && docker build -t metagpt:custom . +``` diff --git a/docs/install/docker_install_cn.md b/docs/install/docker_install_cn.md new file mode 100644 index 000000000..347fae10c --- /dev/null +++ b/docs/install/docker_install_cn.md @@ -0,0 +1,44 @@ +## Docker安装 + +### 使用MetaGPT镜像 + +```bash +# 步骤1: 下载metagpt官方镜像并准备好config.yaml +docker pull metagpt/metagpt:latest +mkdir -p /opt/metagpt/{config,workspace} +docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml +vim /opt/metagpt/config/key.yaml # 修改配置文件 + +# 步骤2: 使用容器运行metagpt演示 +docker run --rm \ + --privileged \ + -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \ + -v /opt/metagpt/workspace:/app/metagpt/workspace \ + metagpt/metagpt:latest \ + python startup.py "Write a cli snake game" + +# 您也可以启动一个容器并在其中执行命令 +docker run --name metagpt -d \ + --privileged \ + -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \ + -v /opt/metagpt/workspace:/app/metagpt/workspace \ + metagpt/metagpt:latest + +docker exec -it metagpt /bin/bash +$ python startup.py "Write a cli snake game" +``` + +`docker run ...`做了以下事情: + +- 以特权模式运行,有权限运行浏览器 +- 将主机文件 `/opt/metagpt/config/key.yaml` 映射到容器文件 `/app/metagpt/config/key.yaml` +- 将主机目录 `/opt/metagpt/workspace` 映射到容器目录 `/app/metagpt/workspace` +- 执行示例命令 `python startup.py "Write a cli snake game"` + +### 自己构建镜像 + +```bash +# 您也可以自己构建metagpt镜像 +git clone https://github.com/geekan/MetaGPT.git +cd MetaGPT && docker build -t metagpt:custom . +``` From d62cf5cf1d68881d10bb11b5adf2f594a3d3589f Mon Sep 17 00:00:00 2001 From: better629 Date: Fri, 27 Oct 2023 17:08:25 +0800 Subject: [PATCH 03/15] update EN&CN README --- README.md | 280 ++++++---------------------------------- docs/README_CN.md | 194 +++++++--------------------- docs/examples/README.md | 0 3 files changed, 88 insertions(+), 386 deletions(-) create mode 100644 docs/examples/README.md diff --git a/README.md b/README.md index 70460ceb4..f3fb3dff9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ # MetaGPT: The Multi-Agent Framework CN doc EN doc JA doc -Discord Follow +Discord Follow License: MIT roadmap Twitter Follow @@ -33,31 +33,9 @@ # MetaGPT: The Multi-Agent Framework

Software Company Multi-Role Schematic (Gradually Implementing)

-## MetaGPT's Abilities +## Install - -https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419 - - - -## Examples (fully generated by GPT-4) - -For example, if you type `python startup.py "Design a RecSys like Toutiao"`, you would get many outputs, one of them is data & api design - -![Jinri Toutiao Recsys Data & API Design](docs/resources/workspace/content_rec_sys/resources/data_api_design.png) - -It costs approximately **$0.2** (in GPT-4 API fees) to generate one example with analysis and design, and around **$2.0** for a full project. - - - - -## Installation - -### Installation Video Guide - -- [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY) - -### Traditional Installation +### Conda installation ```bash # Step 1: Ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) @@ -65,100 +43,24 @@ # Step 1: Ensure that NPM is installed on your system. Then install mermaid-js. sudo npm install -g @mermaid-js/mermaid-cli # Step 2: Ensure that Python 3.9+ is installed on your system. You can check this by using: -python --version +# You can use conda to initialize a new python env +# conda create -n metagpt python=3.9 +# conda activate metagpt +python3 --version # Step 3: Clone the repository to your local machine, and install it. git clone https://github.com/geekan/metagpt cd metagpt -pip install -e. +pip3 install -e. + +# Step 4: run the startup.py +# setup your OPENAI_API_KEY in key.yaml copy from config.yaml +python3 startup.py "Write a cli snake game" ``` -**Note:** +detail installation please refer to [cli_install](docs/install/cli_install.md) -- If already have Chrome, Chromium, or MS Edge installed, you can skip downloading Chromium by setting the environment variable - `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` to `true`. - -- Some people are [having issues](https://github.com/mermaidjs/mermaid.cli/issues/15) installing this tool globally. Installing it locally is an alternative solution, - - ```bash - npm install @mermaid-js/mermaid-cli - ``` - -- don't forget to the configuration for mmdc in config.yml - - ```yml - PUPPETEER_CONFIG: "./config/puppeteer-config.json" - MMDC: "./node_modules/.bin/mmdc" - ``` - -- if `pip install -e.` fails with error `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`, try instead running `pip install -e. --user` - -- To convert Mermaid charts to SVG, PNG, and PDF formats. In addition to the Node.js version of Mermaid-CLI, you now have the option to use Python version Playwright, pyppeteer or mermaid.ink for this task. - - - Playwright - - **Install Playwright** - - ```bash - pip install playwright - ``` - - - **Install the Required Browsers** - - to support PDF conversion, please install Chrominum. - - ```bash - playwright install --with-deps chromium - ``` - - - **modify `config.yaml`** - - uncomment MERMAID_ENGINE from config.yaml and change it to `playwright` - - ```yaml - MERMAID_ENGINE: playwright - ``` - - - pyppeteer - - **Install pyppeteer** - - ```bash - pip install pyppeteer - ``` - - - **Use your own Browsers** - - pyppeteer allows you use installed browsers, please set the following envirment - - ```bash - export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chrome - ``` - - please do not use this command to install browser, it is too old - - ```bash - pyppeteer-install - ``` - - - **modify `config.yaml`** - - uncomment MERMAID_ENGINE from config.yaml and change it to `pyppeteer` - - ```yaml - MERMAID_ENGINE: pyppeteer - ``` - - - mermaid.ink - - **modify `config.yaml`** - - uncomment MERMAID_ENGINE from config.yaml and change it to `ink` - - ```yaml - MERMAID_ENGINE: ink - ``` - - Note: this method does not support pdf export. - -### Installation by Docker +### Docker installation ```bash # Step 1: Download metagpt official image and prepare config.yaml @@ -174,124 +76,46 @@ # Step 2: Run metagpt demo with container -v /opt/metagpt/workspace:/app/metagpt/workspace \ metagpt/metagpt:latest \ python startup.py "Write a cli snake game" - -# You can also start a container and execute commands in it -docker run --name metagpt -d \ - --privileged \ - -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \ - -v /opt/metagpt/workspace:/app/metagpt/workspace \ - metagpt/metagpt:latest - -docker exec -it metagpt /bin/bash -$ python startup.py "Write a cli snake game" ``` -The command `docker run ...` do the following things: +detail installation please refer to [docker_install](docs/install/docker_install.md) -- Run in privileged mode to have permission to run the browser -- Map host configure file `/opt/metagpt/config/key.yaml` to container `/app/metagpt/config/key.yaml` -- Map host directory `/opt/metagpt/workspace` to container `/app/metagpt/workspace` -- Execute the demo command `python startup.py "Write a cli snake game"` +### QuickStart & Demo Video +- Try it on [MetaGPT Huggingface Space](https://huggingface.co/spaces/deepwisdom/MetaGPT) +- [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY) +- [Official Demo Video](https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d) -### Build image by yourself +## Tutorial -```bash -# You can also build metagpt image by yourself. -git clone https://github.com/geekan/MetaGPT.git -cd MetaGPT && docker build -t metagpt:custom . -``` +- [Oneline Document]() +- [Usage](docs/tutorial/usage.md) +- [What can MetaGPT do?](docs/tutorial/what_can_this_do.md) +- How to build your own agents? + - [MetaGPT Usage & Development Guide](https://deepwisdom.feishu.cn/wiki/RUnswqUIPimRJmkkDZ7cLYwOndg#Yu2AdUvymoo67Jxbp0bcu8G4nEb) +- [Contribution](docs/develop/contribution.md) + - Develop RFC + - [Develop Roadmap](docs/ROADMAP.md) +- [Examples](docs/examples/README.md) + - Researcher + - Werewolf Game +- [FAQs](docs/tutorial/faq.md) +- [The generated projects display wall](https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419) -## Configuration +## Support -- Configure your `OPENAI_API_KEY` in any of `config/key.yaml / config/config.yaml / env` -- Priority order: `config/key.yaml > config/config.yaml > env` +### Discard Join US +📢 Join Our [Discord Channel](https://discord.gg/ZRHeExS6xv)! -```bash -# Copy the configuration file and make the necessary modifications. -cp config/config.yaml config/key.yaml -``` +Looking forward to seeing you there! 🎉 -| Variable Name | config/key.yaml | env | -| ------------------------------------------ | ----------------------------------------- | ----------------------------------------------- | -| OPENAI_API_KEY # Replace with your own key | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." | -| OPENAI_API_BASE # Optional | OPENAI_API_BASE: "https:///v1" | export OPENAI_API_BASE="https:///v1" | +### Contact Information -## Tutorial: Initiating a startup +If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions! -```shell -# Run the script -python startup.py "Write a cli snake game" -# Do not hire an engineer to implement the project -python startup.py "Write a cli snake game" --implement False -# Hire an engineer and perform code reviews -python startup.py "Write a cli snake game" --code_review True -``` +- **Email:** alexanderwu@fuzhi.ai +- **GitHub Issues:** For more technical inquiries, you can also create a new issue in our [GitHub repository](https://github.com/geekan/metagpt/issues). -After running the script, you can find your new project in the `workspace/` directory. - -### Preference of Platform or Tool - -You can tell which platform or tool you want to use when stating your requirements. - -```shell -python startup.py "Write a cli snake game based on pygame" -``` - -### Usage - -``` -NAME - startup.py - We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities. - -SYNOPSIS - startup.py IDEA - -DESCRIPTION - We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities. - -POSITIONAL ARGUMENTS - IDEA - Type: str - Your innovative idea, such as "Creating a snake game." - -FLAGS - --investment=INVESTMENT - Type: float - Default: 3.0 - As an investor, you have the opportunity to contribute a certain dollar amount to this AI company. - --n_round=N_ROUND - Type: int - Default: 5 - -NOTES - You can also use flags syntax for POSITIONAL ARGUMENTS -``` - -### Code walkthrough - -```python -from metagpt.software_company import SoftwareCompany -from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer - -async def startup(idea: str, investment: float = 3.0, n_round: int = 5): - """Run a startup. Be a boss.""" - company = SoftwareCompany() - company.hire([ProductManager(), Architect(), ProjectManager(), Engineer()]) - company.invest(investment) - company.start_project(idea) - await company.run(n_round=n_round) -``` - -You can check `examples` for more details on single role (with knowledge base) and LLM only examples. - -## QuickStart - -It is difficult to install and configure the local environment for some users. The following tutorials will allow you to quickly experience the charm of MetaGPT. - -- [MetaGPT quickstart](https://deepwisdom.feishu.cn/wiki/CyY9wdJc4iNqArku3Lncl4v8n2b) - -Try it on Huggingface Space -- https://huggingface.co/spaces/deepwisdom/MetaGPT +We will respond to all questions within 2-3 business days. ## Citation @@ -307,23 +131,3 @@ ## Citation primaryClass={cs.AI} } ``` - -## Contact Information - -If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions! - -- **Email:** alexanderwu@fuzhi.ai -- **GitHub Issues:** For more technical inquiries, you can also create a new issue in our [GitHub repository](https://github.com/geekan/metagpt/issues). - -We will respond to all questions within 2-3 business days. - -## Demo - -https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d - -## Join us - -📢 Join Our Discord Channel! -https://discord.gg/ZRHeExS6xv - -Looking forward to seeing you there! 🎉 diff --git a/docs/README_CN.md b/docs/README_CN.md index 9d6f34c11..8c04e5066 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -12,7 +12,7 @@ # MetaGPT: 多智能体框架 CN doc EN doc JA doc -Discord Follow +Discord Follow License: MIT roadmap Twitter Follow @@ -33,22 +33,8 @@ # MetaGPT: 多智能体框架

软件公司多角色示意图(正在逐步实现)

-## MetaGPT 的能力 - -https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419 - - -## 示例(均由 GPT-4 生成) - -例如,键入`python startup.py "写个类似今日头条的推荐系统"`并回车,你会获得一系列输出,其一是数据结构与API设计 - -![今日头条 Recsys 数据 & API 设计](resources/workspace/content_rec_sys/resources/data_api_design.png) - -这需要大约**0.2美元**(GPT-4 API的费用)来生成一个带有分析和设计的示例,大约2.0美元用于一个完整的项目 - ## 安装 - -### 传统安装 +### Conda安装 ```bash # 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js @@ -56,32 +42,22 @@ # 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js sudo npm install -g @mermaid-js/mermaid-cli # 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查: +# 可以使用conda来初始化新的python环境 +# conda create -n metagpt python=3.9 +# conda activate metagpt python --version # 第 3 步:克隆仓库到您的本地机器,并进行安装。 git clone https://github.com/geekan/metagpt cd metagpt pip install -e. + +# 第 4 步:执行startup.py +# 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY +python3 startup.py "Write a cli snake game" ``` -**注意:** - -- 如果已经安装了Chrome、Chromium或MS Edge,可以通过将环境变量`PUPPETEER_SKIP_CHROMIUM_DOWNLOAD`设置为`true`来跳过下载Chromium。 - -- 一些人在全局安装此工具时遇到问题。在本地安装是替代解决方案, - - ```bash - npm install @mermaid-js/mermaid-cli - ``` - -- 不要忘记在config.yml中为mmdc配置配置, - - ```yml - PUPPETEER_CONFIG: "./config/puppeteer-config.json" - MMDC: "./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`运行。 +详细的安装请安装 [cli_install](docs/install/cli_install_cn.md) ### Docker安装 @@ -99,121 +75,39 @@ # 步骤2: 使用容器运行metagpt演示 -v /opt/metagpt/workspace:/app/metagpt/workspace \ metagpt/metagpt:latest \ python startup.py "Write a cli snake game" - -# 您也可以启动一个容器并在其中执行命令 -docker run --name metagpt -d \ - --privileged \ - -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \ - -v /opt/metagpt/workspace:/app/metagpt/workspace \ - metagpt/metagpt:latest - -docker exec -it metagpt /bin/bash -$ python startup.py "Write a cli snake game" ``` -`docker run ...`做了以下事情: +详细的安装请安装 [docker_install](docs/install/docker_install_cn.md) -- 以特权模式运行,有权限运行浏览器 -- 将主机文件 `/opt/metagpt/config/key.yaml` 映射到容器文件 `/app/metagpt/config/key.yaml` -- 将主机目录 `/opt/metagpt/workspace` 映射到容器目录 `/app/metagpt/workspace` -- 执行示例命令 `python startup.py "Write a cli snake game"` +### 快速开始的演示视频 +- 在 [MetaGPT Huggingface Space](https://huggingface.co/spaces/deepwisdom/MetaGPT) 上进行体验 +- [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY) +- [官方演示视频](https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d) -### 自己构建镜像 +## 教程 +- [在线文档]() +- [如何使用](docs/tutorial/usage_cn.md) +- [MetaGPT的能力及应用场景](docs/tutorial/what_can_this_do.md) +- 如何构建你自己得智能体? + - [MetaGPT的使用和开发教程](https://deepwisdom.feishu.cn/wiki/RUnswqUIPimRJmkkDZ7cLYwOndg#Yu2AdUvymoo67Jxbp0bcu8G4nEb) +- [贡献](docs/develop/contribution.md) + - 开发者RFC + - [开发路线图](docs/ROADMAP.md) +- [样例](docs/examples/README.md) + - 调研员 + - 狼人杀游戏 +- [常见问题解答](docs/tutorial/faq.md) +- [已生成项目的展示墙](https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419) -```bash -# 您也可以自己构建metagpt镜像 -git clone https://github.com/geekan/MetaGPT.git -cd MetaGPT && docker build -t metagpt:custom . -``` +## 支持 -## 配置 +### 加入我们 -- 在 `config/key.yaml / config/config.yaml / env` 中配置您的 `OPENAI_API_KEY` -- 优先级顺序:`config/key.yaml > config/config.yaml > env` +📢 加入我们的[Discord频道](https://discord.gg/ZRHeExS6xv)! -```bash -# 复制配置文件并进行必要的修改 -cp config/config.yaml config/key.yaml -``` +期待在那里与您相见!🎉 -| 变量名 | config/key.yaml | env | -| ----------------------------------- | ----------------------------------------- | ----------------------------------------------- | -| OPENAI_API_KEY # 用您自己的密钥替换 | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." | -| OPENAI_API_BASE # 可选 | OPENAI_API_BASE: "https:///v1" | export OPENAI_API_BASE="https:///v1" | - -## 示例:启动一个创业公司 - -```shell -python startup.py "写一个命令行贪吃蛇" -# 开启code review模式会花费更多的金钱, 但是会提升代码质量和成功率 -python startup.py "写一个命令行贪吃蛇" --code_review True -``` - -运行脚本后,您可以在 `workspace/` 目录中找到您的新项目。 -### 平台或工具的倾向性 -可以在阐述需求时说明想要使用的平台或工具。 -例如: -```shell -python startup.py "写一个基于pygame的命令行贪吃蛇" -``` - -### 使用 - -``` -名称 - startup.py - 我们是一家AI软件创业公司。通过投资我们,您将赋能一个充满无限可能的未来。 - -概要 - startup.py IDEA - -描述 - 我们是一家AI软件创业公司。通过投资我们,您将赋能一个充满无限可能的未来。 - -位置参数 - IDEA - 类型: str - 您的创新想法,例如"写一个命令行贪吃蛇。" - -标志 - --investment=INVESTMENT - 类型: float - 默认值: 3.0 - 作为投资者,您有机会向这家AI公司投入一定的美元金额。 - --n_round=N_ROUND - 类型: int - 默认值: 5 - -备注 - 您也可以用`标志`的语法,来处理`位置参数` -``` - -### 代码实现 - -```python -from metagpt.software_company import SoftwareCompany -from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer - -async def startup(idea: str, investment: float = 3.0, n_round: int = 5): - """运行一个创业公司。做一个老板""" - company = SoftwareCompany() - company.hire([ProductManager(), Architect(), ProjectManager(), Engineer()]) - company.invest(investment) - company.start_project(idea) - await company.run(n_round=n_round) -``` - -你可以查看`examples`,其中有单角色(带知识库)的使用例子与仅LLM的使用例子。 - -## 快速体验 -对一些用户来说,安装配置本地环境是有困难的,下面这些教程能够让你快速体验到MetaGPT的魅力。 - -- [MetaGPT快速体验](https://deepwisdom.feishu.cn/wiki/Q8ycw6J9tiNXdHk66MRcIN8Pnlg) - -可直接在Huggingface Space体验 - -- https://huggingface.co/spaces/deepwisdom/MetaGPT - -## 联系信息 +### 联系信息 如果您对这个项目有任何问题或反馈,欢迎联系我们。我们非常欢迎您的建议! @@ -222,13 +116,17 @@ ## 联系信息 我们会在2-3个工作日内回复所有问题。 -## 演示 +## 引用 -https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d +引用 [Arxiv paper](https://arxiv.org/abs/2308.00352): -## 加入我们 - -📢 加入我们的Discord频道! -https://discord.gg/ZRHeExS6xv - -期待在那里与您相见!🎉 +```bibtex +@misc{hong2023metagpt, + title={MetaGPT: Meta Programming for Multi-Agent Collaborative Framework}, + author={Sirui Hong and Xiawu Zheng and Jonathan Chen 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}, + year={2023}, + eprint={2308.00352}, + archivePrefix={arXiv}, + primaryClass={cs.AI} +} +``` diff --git a/docs/examples/README.md b/docs/examples/README.md new file mode 100644 index 000000000..e69de29bb From 7d28509edccbd28db957c803447a19e4500262f9 Mon Sep 17 00:00:00 2001 From: better629 Date: Thu, 2 Nov 2023 21:27:52 +0800 Subject: [PATCH 04/15] update examples README --- docs/examples/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/examples/README.md b/docs/examples/README.md index e69de29bb..4fe4628e2 100644 --- a/docs/examples/README.md +++ b/docs/examples/README.md @@ -0,0 +1,12 @@ +## Examples +We introduce some example agents created recently and show how to created these agents under the framework. + +- Researcher + - With the given research topic, the agent will derive the keywords from the topic and then search the related documents using search engine api. + - The search result will be ranked and filtered to get high quality candidates. + - Summary the final content using the candidate documents as context. +- Invoice OCR and QA + - With the given one or multi invoices, the agent can recognize the text from the image or pdf. + - Organize the text with particular structure, generally, it will be saved in a csv. + - It can answer your question like `what's the total reimbursement of Alice?` +- Werewolf Game From 0bf2ce707e6fdf65a883da9dbf82d9bb2682f337 Mon Sep 17 00:00:00 2001 From: garylin2099 Date: Thu, 9 Nov 2023 01:41:24 +0800 Subject: [PATCH 05/15] allow human to play any roles --- metagpt/llm.py | 1 + metagpt/provider/human_gpt.py | 35 +++++++++++++++++++++++++++++++++++ metagpt/roles/role.py | 15 ++++++++++----- 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 metagpt/provider/human_gpt.py diff --git a/metagpt/llm.py b/metagpt/llm.py index e6f815950..8b4a13838 100644 --- a/metagpt/llm.py +++ b/metagpt/llm.py @@ -8,6 +8,7 @@ from metagpt.provider.anthropic_api import Claude2 as Claude from metagpt.provider.openai_api import OpenAIGPTAPI as LLM +from metagpt.provider.human_gpt import HumanGPT DEFAULT_LLM = LLM() CLAUDE_LLM = Claude() diff --git a/metagpt/provider/human_gpt.py b/metagpt/provider/human_gpt.py new file mode 100644 index 000000000..bc4d6dc6e --- /dev/null +++ b/metagpt/provider/human_gpt.py @@ -0,0 +1,35 @@ +''' +Filename: MetaGPT/metagpt/provider/human_speaker.py +Created Date: Wednesday, November 8th 2023, 11:55:46 pm +Author: garylin2099 +''' +from typing import Optional +from metagpt.provider.base_gpt_api import BaseGPTAPI +from metagpt.logs import logger + +class HumanGPT(BaseGPTAPI): + """A dummy GPT that actually takes in human input as its response. + This enables replacing LLM anywhere in the framework with a human, thus introducing human interaction + """ + + def ask(self, msg: str) -> str: + logger.info("It's your turn, please type in your response. You may also refer to the context below") + rsp = input(msg) + if rsp in ["exit", "quit"]: + exit() + return rsp + + async def aask(self, msg: str, system_msgs: Optional[list[str]] = None) -> str: + return self.ask(msg) + + def completion(self, messages: list[dict]): + """dummy implementation of abstract method in base""" + return [] + + async def acompletion(self, messages: list[dict]): + """dummy implementation of abstract method in base""" + return [] + + async def acompletion_text(self, messages: list[dict], stream=False) -> str: + """dummy implementation of abstract method in base""" + return [] diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 0251176f7..fecca0beb 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -15,7 +15,7 @@ from pydantic import BaseModel, Field # from metagpt.environment import Environment from metagpt.config import CONFIG from metagpt.actions import Action, ActionOutput -from metagpt.llm import LLM +from metagpt.llm import LLM, HumanGPT from metagpt.logs import logger from metagpt.memory import Memory, LongTermMemory from metagpt.schema import Message @@ -65,6 +65,7 @@ class RoleSetting(BaseModel): goal: str constraints: str desc: str + is_human: bool def __str__(self): return f"{self.name}({self.profile})" @@ -106,9 +107,10 @@ class RoleContext(BaseModel): class Role: """Role/Agent""" - def __init__(self, name="", profile="", goal="", constraints="", desc=""): - self._llm = LLM() - self._setting = RoleSetting(name=name, profile=profile, goal=goal, constraints=constraints, desc=desc) + def __init__(self, name="", profile="", goal="", constraints="", desc="", is_human=False): + self._llm = LLM() if not is_human else HumanGPT() + self._setting = RoleSetting(name=name, profile=profile, goal=goal, + constraints=constraints, desc=desc, is_human=is_human) self._states = [] self._actions = [] self._role_id = str(self._setting) @@ -122,8 +124,11 @@ class Role: self._reset() for idx, action in enumerate(actions): if not isinstance(action, Action): - i = action("") + i = action("", llm=self._llm) else: + if self._setting.is_human and not isinstance(action.llm, HumanGPT): + logger.warning(f"is_human attribute does not take effect," + f"as Role's {str(action)} was initialized using LLM, try passing in Action classes instead of initialized instances") i = action i.set_prefix(self._get_prefix(), self.profile) self._actions.append(i) From 7bf808ee258fe15ab08ad234a081ef1660548833 Mon Sep 17 00:00:00 2001 From: garylin2099 Date: Fri, 17 Nov 2023 00:20:46 +0800 Subject: [PATCH 06/15] renaming & provide example & small bug fix --- examples/build_customized_agent.py | 17 +- examples/build_customized_multi_agents.py | 150 ++++++++++++++++++ examples/debate.py | 2 + metagpt/llm.py | 2 +- .../{human_gpt.py => human_provider.py} | 6 +- metagpt/roles/role.py | 6 +- 6 files changed, 164 insertions(+), 19 deletions(-) create mode 100644 examples/build_customized_multi_agents.py rename metagpt/provider/{human_gpt.py => human_provider.py} (85%) diff --git a/examples/build_customized_agent.py b/examples/build_customized_agent.py index c7069b768..ed00e8320 100644 --- a/examples/build_customized_agent.py +++ b/examples/build_customized_agent.py @@ -19,15 +19,6 @@ class SimpleWriteCode(Action): PROMPT_TEMPLATE = """ Write a python function that can {instruction} and provide two runnnable test cases. Return ```python your_code_here ``` with NO other texts, - example: - ```python - # function - def add(a, b): - return a + b - # test cases - print(add(1, 2)) - print(add(3, 4)) - ``` your code: """ @@ -73,12 +64,12 @@ class SimpleCoder(Role): async def _act(self) -> Message: logger.info(f"{self._setting}: ready to {self._rc.todo}") - todo = self._rc.todo + todo = self._rc.todo # todo will be SimpleWriteCode() msg = self.get_memories(k=1)[0] # find the most recent messages - code_text = await SimpleWriteCode().run(msg.content) - msg = Message(content=code_text, role=self.profile, cause_by=todo) + code_text = await todo.run(msg.content) + msg = Message(content=code_text, role=self.profile, cause_by=type(todo)) return msg @@ -95,6 +86,8 @@ class RunnableCoder(Role): async def _act(self) -> Message: logger.info(f"{self._setting}: ready to {self._rc.todo}") + # By choosing the Action by order under the hood + # todo will be first SimpleWriteCode() then SimpleRunCode() todo = self._rc.todo msg = self.get_memories(k=1)[0] # find the most k recent messages diff --git a/examples/build_customized_multi_agents.py b/examples/build_customized_multi_agents.py new file mode 100644 index 000000000..02221e8e9 --- /dev/null +++ b/examples/build_customized_multi_agents.py @@ -0,0 +1,150 @@ +''' +Filename: MetaGPT/examples/build_customized_multi_agents.py +Created Date: Wednesday, November 15th 2023, 7:12:39 pm +Author: garylin2099 +''' +import re +import asyncio +import fire +from metagpt.actions import Action, BossRequirement +from metagpt.roles import Role +from metagpt.team import Team +from metagpt.schema import Message +from metagpt.logs import logger + +def parse_code(rsp): + pattern = r'```python(.*)```' + match = re.search(pattern, rsp, re.DOTALL) + code_text = match.group(1) if match else rsp + return code_text + +class SimpleWriteCode(Action): + + PROMPT_TEMPLATE = """ + Write a python function that can {instruction}. + Return ```python your_code_here ``` with NO other texts, + your code: + """ + + def __init__(self, name="SimpleWriteCode", context=None, llm=None): + super().__init__(name, context, llm) + + async def run(self, instruction: str): + + prompt = self.PROMPT_TEMPLATE.format(instruction=instruction) + + rsp = await self._aask(prompt) + + code_text = parse_code(rsp) + + return code_text + +class SimpleCoder(Role): + def __init__( + self, + name: str = "Alice", + profile: str = "SimpleCoder", + **kwargs, + ): + super().__init__(name, profile, **kwargs) + self._watch([BossRequirement]) + self._init_actions([SimpleWriteCode]) + +class SimpleWriteTest(Action): + + PROMPT_TEMPLATE = """ + Context: {context} + Write {k} unit tests using pytest for the given function, assuming you have imported it. + Return ```python your_code_here ``` with NO other texts, + your code: + """ + + def __init__(self, name="SimpleWriteTest", context=None, llm=None): + super().__init__(name, context, llm) + + async def run(self, context: str, k: int = 3): + + prompt = self.PROMPT_TEMPLATE.format(context=context, k=k) + + rsp = await self._aask(prompt) + + code_text = parse_code(rsp) + + return code_text + +class SimpleTester(Role): + def __init__( + self, + name: str = "Bob", + profile: str = "SimpleTester", + **kwargs, + ): + super().__init__(name, profile, **kwargs) + self._init_actions([SimpleWriteTest]) + # self._watch([SimpleWriteCode]) + self._watch([SimpleWriteCode, SimpleWriteReview]) # feel free to try this too + + async def _act(self) -> Message: + logger.info(f"{self._setting}: ready to {self._rc.todo}") + todo = self._rc.todo + + # context = self.get_memories(k=1)[0].content # use the most recent memory as context + context = self.get_memories() # use all memories as context + + code_text = await todo.run(context, k=5) # specify arguments + msg = Message(content=code_text, role=self.profile, cause_by=type(todo)) + + return msg + +class SimpleWriteReview(Action): + + PROMPT_TEMPLATE = """ + Context: {context} + Review the test cases and provide one critical comments: + """ + + def __init__(self, name="SimpleWriteReview", context=None, llm=None): + super().__init__(name, context, llm) + + async def run(self, context: str): + + prompt = self.PROMPT_TEMPLATE.format(context=context) + + rsp = await self._aask(prompt) + + return rsp + +class SimpleReviewer(Role): + def __init__( + self, + name: str = "Charlie", + profile: str = "SimpleReviewer", + **kwargs, + ): + super().__init__(name, profile, **kwargs) + self._init_actions([SimpleWriteReview]) + self._watch([SimpleWriteTest]) + +async def main( + idea: str = "write a function that calculates the product of a list", + investment: float = 3.0, + n_round: int = 5, + add_human: bool = False, +): + logger.info(idea) + + team = Team() + team.hire( + [ + SimpleCoder(), + SimpleTester(), + SimpleReviewer(is_human=add_human), + ] + ) + + team.invest(investment=investment) + team.start_project(idea) + await team.run(n_round=n_round) + +if __name__ == '__main__': + fire.Fire(main) diff --git a/examples/debate.py b/examples/debate.py index 4db7567f0..a37e60848 100644 --- a/examples/debate.py +++ b/examples/debate.py @@ -77,6 +77,8 @@ class Debator(Role): send_to=self.opponent_name, ) + self._rc.memory.add(msg) + return msg async def debate(idea: str, investment: float = 3.0, n_round: int = 5): diff --git a/metagpt/llm.py b/metagpt/llm.py index 8b4a13838..9324da126 100644 --- a/metagpt/llm.py +++ b/metagpt/llm.py @@ -8,7 +8,7 @@ from metagpt.provider.anthropic_api import Claude2 as Claude from metagpt.provider.openai_api import OpenAIGPTAPI as LLM -from metagpt.provider.human_gpt import HumanGPT +from metagpt.provider.human_provider import HumanProvider DEFAULT_LLM = LLM() CLAUDE_LLM = Claude() diff --git a/metagpt/provider/human_gpt.py b/metagpt/provider/human_provider.py similarity index 85% rename from metagpt/provider/human_gpt.py rename to metagpt/provider/human_provider.py index bc4d6dc6e..1d12f972f 100644 --- a/metagpt/provider/human_gpt.py +++ b/metagpt/provider/human_provider.py @@ -1,5 +1,5 @@ ''' -Filename: MetaGPT/metagpt/provider/human_speaker.py +Filename: MetaGPT/metagpt/provider/human_provider.py Created Date: Wednesday, November 8th 2023, 11:55:46 pm Author: garylin2099 ''' @@ -7,8 +7,8 @@ from typing import Optional from metagpt.provider.base_gpt_api import BaseGPTAPI from metagpt.logs import logger -class HumanGPT(BaseGPTAPI): - """A dummy GPT that actually takes in human input as its response. +class HumanProvider(BaseGPTAPI): + """Humans provide themselves as a 'model', which actually takes in human input as its response. This enables replacing LLM anywhere in the framework with a human, thus introducing human interaction """ diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index fecca0beb..b96c361c0 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -15,7 +15,7 @@ from pydantic import BaseModel, Field # from metagpt.environment import Environment from metagpt.config import CONFIG from metagpt.actions import Action, ActionOutput -from metagpt.llm import LLM, HumanGPT +from metagpt.llm import LLM, HumanProvider from metagpt.logs import logger from metagpt.memory import Memory, LongTermMemory from metagpt.schema import Message @@ -108,7 +108,7 @@ class Role: """Role/Agent""" def __init__(self, name="", profile="", goal="", constraints="", desc="", is_human=False): - self._llm = LLM() if not is_human else HumanGPT() + self._llm = LLM() if not is_human else HumanProvider() self._setting = RoleSetting(name=name, profile=profile, goal=goal, constraints=constraints, desc=desc, is_human=is_human) self._states = [] @@ -126,7 +126,7 @@ class Role: if not isinstance(action, Action): i = action("", llm=self._llm) else: - if self._setting.is_human and not isinstance(action.llm, HumanGPT): + if self._setting.is_human and not isinstance(action.llm, HumanProvider): logger.warning(f"is_human attribute does not take effect," f"as Role's {str(action)} was initialized using LLM, try passing in Action classes instead of initialized instances") i = action From 705a3e962b2d5a7d8bb643901b84f0d9b34870e2 Mon Sep 17 00:00:00 2001 From: garylin2099 Date: Fri, 17 Nov 2023 14:40:07 +0800 Subject: [PATCH 07/15] formatting --- examples/build_customized_agent.py | 9 +++++++-- examples/build_customized_multi_agents.py | 14 +++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/examples/build_customized_agent.py b/examples/build_customized_agent.py index ed00e8320..be34e5e5e 100644 --- a/examples/build_customized_agent.py +++ b/examples/build_customized_agent.py @@ -9,6 +9,7 @@ import asyncio import fire +from metagpt.llm import LLM from metagpt.actions import Action from metagpt.roles import Role from metagpt.schema import Message @@ -22,7 +23,7 @@ class SimpleWriteCode(Action): your code: """ - def __init__(self, name="SimpleWriteCode", context=None, llm=None): + def __init__(self, name: str = "SimpleWriteCode", context=None, llm: LLM = None): super().__init__(name, context, llm) async def run(self, instruction: str): @@ -42,8 +43,9 @@ class SimpleWriteCode(Action): code_text = match.group(1) if match else rsp return code_text + class SimpleRunCode(Action): - def __init__(self, name="SimpleRunCode", context=None, llm=None): + def __init__(self, name: str = "SimpleRunCode", context=None, llm: LLM = None): super().__init__(name, context, llm) async def run(self, code_text: str): @@ -52,6 +54,7 @@ class SimpleRunCode(Action): logger.info(f"{code_result=}") return code_result + class SimpleCoder(Role): def __init__( self, @@ -73,6 +76,7 @@ class SimpleCoder(Role): return msg + class RunnableCoder(Role): def __init__( self, @@ -97,6 +101,7 @@ class RunnableCoder(Role): self._rc.memory.add(msg) return msg + def main(msg="write a function that calculates the product of a list and run it"): # role = SimpleCoder() role = RunnableCoder() diff --git a/examples/build_customized_multi_agents.py b/examples/build_customized_multi_agents.py index 02221e8e9..0df927e32 100644 --- a/examples/build_customized_multi_agents.py +++ b/examples/build_customized_multi_agents.py @@ -6,6 +6,8 @@ Author: garylin2099 import re import asyncio import fire + +from metagpt.llm import LLM from metagpt.actions import Action, BossRequirement from metagpt.roles import Role from metagpt.team import Team @@ -26,7 +28,7 @@ class SimpleWriteCode(Action): your code: """ - def __init__(self, name="SimpleWriteCode", context=None, llm=None): + def __init__(self, name: str = "SimpleWriteCode", context=None, llm: LLM = None): super().__init__(name, context, llm) async def run(self, instruction: str): @@ -39,6 +41,7 @@ class SimpleWriteCode(Action): return code_text + class SimpleCoder(Role): def __init__( self, @@ -50,6 +53,7 @@ class SimpleCoder(Role): self._watch([BossRequirement]) self._init_actions([SimpleWriteCode]) + class SimpleWriteTest(Action): PROMPT_TEMPLATE = """ @@ -59,7 +63,7 @@ class SimpleWriteTest(Action): your code: """ - def __init__(self, name="SimpleWriteTest", context=None, llm=None): + def __init__(self, name: str = "SimpleWriteTest", context=None, llm: LLM = None): super().__init__(name, context, llm) async def run(self, context: str, k: int = 3): @@ -72,6 +76,7 @@ class SimpleWriteTest(Action): return code_text + class SimpleTester(Role): def __init__( self, @@ -96,6 +101,7 @@ class SimpleTester(Role): return msg + class SimpleWriteReview(Action): PROMPT_TEMPLATE = """ @@ -103,7 +109,7 @@ class SimpleWriteReview(Action): Review the test cases and provide one critical comments: """ - def __init__(self, name="SimpleWriteReview", context=None, llm=None): + def __init__(self, name: str = "SimpleWriteReview", context=None, llm: LLM = None): super().__init__(name, context, llm) async def run(self, context: str): @@ -114,6 +120,7 @@ class SimpleWriteReview(Action): return rsp + class SimpleReviewer(Role): def __init__( self, @@ -125,6 +132,7 @@ class SimpleReviewer(Role): self._init_actions([SimpleWriteReview]) self._watch([SimpleWriteTest]) + async def main( idea: str = "write a function that calculates the product of a list", investment: float = 3.0, From ef5cb6f6deaf5f3215a895b592ce424e125ef38b Mon Sep 17 00:00:00 2001 From: better629 Date: Sun, 19 Nov 2023 15:38:47 +0800 Subject: [PATCH 08/15] update readme with online docs url --- README.md | 32 ++++++++++++++++++-------------- docs/README_CN.md | 30 ++++++++++++++++-------------- docs/examples/README.md | 12 ------------ 3 files changed, 34 insertions(+), 40 deletions(-) delete mode 100644 docs/examples/README.md diff --git a/README.md b/README.md index f3fb3dff9..60193e086 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ # MetaGPT: The Multi-Agent Framework

Software Company Multi-Role Schematic (Gradually Implementing)

+ + ## Install ### Conda installation @@ -58,7 +60,7 @@ # setup your OPENAI_API_KEY in key.yaml copy from config.yaml python3 startup.py "Write a cli snake game" ``` -detail installation please refer to [cli_install](docs/install/cli_install.md) +detail installation please refer to [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#installation-for-full-features) ### Docker installation @@ -78,28 +80,30 @@ # Step 2: Run metagpt demo with container python startup.py "Write a cli snake game" ``` -detail installation please refer to [docker_install](docs/install/docker_install.md) +detail installation please refer to [docker_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-with-docker) ### QuickStart & Demo Video - Try it on [MetaGPT Huggingface Space](https://huggingface.co/spaces/deepwisdom/MetaGPT) - [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY) - [Official Demo Video](https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d) +https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419 + ## Tutorial -- [Oneline Document]() -- [Usage](docs/tutorial/usage.md) -- [What can MetaGPT do?](docs/tutorial/what_can_this_do.md) -- How to build your own agents? - - [MetaGPT Usage & Development Guide](https://deepwisdom.feishu.cn/wiki/RUnswqUIPimRJmkkDZ7cLYwOndg#Yu2AdUvymoo67Jxbp0bcu8G4nEb) -- [Contribution](docs/develop/contribution.md) - - Develop RFC +- 🗒 [Online Document](https://docs.deepwisdom.ai/) +- 💻 [Usage](https://docs.deepwisdom.ai/guide/get_started/quickstart.html) +- 🔎 [What can MetaGPT do?](https://docs.deepwisdom.ai/guide/get_started/introduction.html) +- 🛠 How to build your own agents? + - [MetaGPT Usage & Development Guide | Agent 101](https://docs.deepwisdom.ai/guide/tutorials/agent_101.html) + - [MetaGPT Usage & Development Guide | MultiAgent 101](https://docs.deepwisdom.ai/guide/tutorials/multi_agent_101.html) +- 🧑‍💻 Contribution - [Develop Roadmap](docs/ROADMAP.md) -- [Examples](docs/examples/README.md) - - Researcher - - Werewolf Game -- [FAQs](docs/tutorial/faq.md) -- [The generated projects display wall](https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419) +- 🔖 Use Cases + - [Debate](https://docs.deepwisdom.ai/guide/use_cases/multi_agent/debate.html) + - [Researcher](https://docs.deepwisdom.ai/guide/use_cases/agent/researcher.html) + - [Recepit Assistant](https://docs.deepwisdom.ai/guide/use_cases/agent/receipt_assistant.html) +- ❓ [FAQs](https://docs.deepwisdom.ai/guide/faq.html) ## Support diff --git a/docs/README_CN.md b/docs/README_CN.md index 8c04e5066..6dac0e210 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -57,7 +57,7 @@ # 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY python3 startup.py "Write a cli snake game" ``` -详细的安装请安装 [cli_install](docs/install/cli_install_cn.md) +详细的安装请安装 [cli_install](https://docs.deepwisdom.ai/zhcn/guide/get_started/installation.html#%E5%AE%89%E8%A3%85%E5%85%A8%E9%83%A8%E5%8A%9F%E8%83%BD) ### Docker安装 @@ -77,27 +77,29 @@ # 步骤2: 使用容器运行metagpt演示 python startup.py "Write a cli snake game" ``` -详细的安装请安装 [docker_install](docs/install/docker_install_cn.md) +详细的安装请安装 [docker_install](https://docs.deepwisdom.ai/zhcn/guide/get_started/installation.html#%E4%BD%BF%E7%94%A8docker%E5%AE%89%E8%A3%85) ### 快速开始的演示视频 - 在 [MetaGPT Huggingface Space](https://huggingface.co/spaces/deepwisdom/MetaGPT) 上进行体验 - [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY) - [官方演示视频](https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d) +https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419 + ## 教程 -- [在线文档]() -- [如何使用](docs/tutorial/usage_cn.md) -- [MetaGPT的能力及应用场景](docs/tutorial/what_can_this_do.md) -- 如何构建你自己得智能体? - - [MetaGPT的使用和开发教程](https://deepwisdom.feishu.cn/wiki/RUnswqUIPimRJmkkDZ7cLYwOndg#Yu2AdUvymoo67Jxbp0bcu8G4nEb) -- [贡献](docs/develop/contribution.md) - - 开发者RFC +- 🗒 [在线文档](https://docs.deepwisdom.ai/zhcn/) +- 💻 [如何使用](https://docs.deepwisdom.ai/zhcn/guide/get_started/quickstart.html) +- 🔎 [MetaGPT的能力及应用场景](https://docs.deepwisdom.ai/zhcn/guide/get_started/introduction.html) +- 🛠 如何构建你自己得智能体? + - [MetaGPT的使用和开发教程 | 智能体入门](https://docs.deepwisdom.ai/zhcn/guide/tutorials/agent_101.html) + - [MetaGPT的使用和开发教程 | 多智能体入门](https://docs.deepwisdom.ai/zhcn/guide/tutorials/multi_agent_101.html) +- 🧑‍💻 贡献 - [开发路线图](docs/ROADMAP.md) -- [样例](docs/examples/README.md) - - 调研员 - - 狼人杀游戏 -- [常见问题解答](docs/tutorial/faq.md) -- [已生成项目的展示墙](https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419) +- 🔖 示例 + - [辩论](https://docs.deepwisdom.ai/zhcn/guide/use_cases/multi_agent/debate.html) + - [调研员](https://docs.deepwisdom.ai/zhcn/guide/use_cases/agent/researcher.html) + - [票据助手](https://docs.deepwisdom.ai/zhcn/guide/use_cases/agent/receipt_assistant.html) +- ❓ [常见问题解答](https://docs.deepwisdom.ai/zhcn/guide/faq.html) ## 支持 diff --git a/docs/examples/README.md b/docs/examples/README.md deleted file mode 100644 index 4fe4628e2..000000000 --- a/docs/examples/README.md +++ /dev/null @@ -1,12 +0,0 @@ -## Examples -We introduce some example agents created recently and show how to created these agents under the framework. - -- Researcher - - With the given research topic, the agent will derive the keywords from the topic and then search the related documents using search engine api. - - The search result will be ranked and filtered to get high quality candidates. - - Summary the final content using the candidate documents as context. -- Invoice OCR and QA - - With the given one or multi invoices, the agent can recognize the text from the image or pdf. - - Organize the text with particular structure, generally, it will be saved in a csv. - - It can answer your question like `what's the total reimbursement of Alice?` -- Werewolf Game From bf47b500bfeeb8b0c53965ce82acf717f058ab56 Mon Sep 17 00:00:00 2001 From: better629 Date: Sun, 19 Nov 2023 15:43:56 +0800 Subject: [PATCH 09/15] fix --- docs/README_CN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README_CN.md b/docs/README_CN.md index 6dac0e210..1839b8f67 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -90,11 +90,11 @@ ## 教程 - 🗒 [在线文档](https://docs.deepwisdom.ai/zhcn/) - 💻 [如何使用](https://docs.deepwisdom.ai/zhcn/guide/get_started/quickstart.html) - 🔎 [MetaGPT的能力及应用场景](https://docs.deepwisdom.ai/zhcn/guide/get_started/introduction.html) -- 🛠 如何构建你自己得智能体? +- 🛠 如何构建你自己的智能体? - [MetaGPT的使用和开发教程 | 智能体入门](https://docs.deepwisdom.ai/zhcn/guide/tutorials/agent_101.html) - [MetaGPT的使用和开发教程 | 多智能体入门](https://docs.deepwisdom.ai/zhcn/guide/tutorials/multi_agent_101.html) - 🧑‍💻 贡献 - - [开发路线图](docs/ROADMAP.md) + - [开发路线图](ROADMAP.md) - 🔖 示例 - [辩论](https://docs.deepwisdom.ai/zhcn/guide/use_cases/multi_agent/debate.html) - [调研员](https://docs.deepwisdom.ai/zhcn/guide/use_cases/agent/researcher.html) From 1b91e66e3aa78099c90239ba6a6f76fcfbc5292e Mon Sep 17 00:00:00 2001 From: better629 Date: Mon, 20 Nov 2023 09:23:47 +0800 Subject: [PATCH 10/15] update --- README.md | 8 ++++---- docs/README_CN.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 60193e086..c537e2a3b 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ # MetaGPT: The Multi-Agent Framework ## Install -### Conda installation +### Pip installation ```bash # Step 1: Ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) @@ -50,17 +50,17 @@ # conda create -n metagpt python=3.9 # conda activate metagpt python3 --version -# Step 3: Clone the repository to your local machine, and install it. +# Step 3: Clone the repository to your local machine for latest version, and install it. git clone https://github.com/geekan/metagpt cd metagpt -pip3 install -e. +pip3 install -e. # or pip3 install metagpt # for stable version # Step 4: run the startup.py # setup your OPENAI_API_KEY in key.yaml copy from config.yaml python3 startup.py "Write a cli snake game" ``` -detail installation please refer to [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#installation-for-full-features) +detail installation please refer to [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-stable-version) ### Docker installation diff --git a/docs/README_CN.md b/docs/README_CN.md index 1839b8f67..3da41793e 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -34,7 +34,7 @@ # MetaGPT: 多智能体框架

软件公司多角色示意图(正在逐步实现)

## 安装 -### Conda安装 +### Pip安装 ```bash # 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js @@ -47,17 +47,17 @@ # conda create -n metagpt python=3.9 # conda activate metagpt python --version -# 第 3 步:克隆仓库到您的本地机器,并进行安装。 +# 第 3 步:克隆最新仓库到您的本地机器,并进行安装。 git clone https://github.com/geekan/metagpt cd metagpt -pip install -e. +pip install -e. # 或者 pip3 install metagpt # 安装稳定版本 # 第 4 步:执行startup.py # 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY python3 startup.py "Write a cli snake game" ``` -详细的安装请安装 [cli_install](https://docs.deepwisdom.ai/zhcn/guide/get_started/installation.html#%E5%AE%89%E8%A3%85%E5%85%A8%E9%83%A8%E5%8A%9F%E8%83%BD) +详细的安装请安装 [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-stable-version) ### Docker安装 From 33ddababfff7e0d4446292d8055fc2bdfe897f7a Mon Sep 17 00:00:00 2001 From: better629 Date: Mon, 20 Nov 2023 09:27:22 +0800 Subject: [PATCH 11/15] update --- docs/README_CN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README_CN.md b/docs/README_CN.md index 3da41793e..22e8358b2 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -45,12 +45,12 @@ # 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下 # 可以使用conda来初始化新的python环境 # conda create -n metagpt python=3.9 # conda activate metagpt -python --version +python3 --version # 第 3 步:克隆最新仓库到您的本地机器,并进行安装。 git clone https://github.com/geekan/metagpt cd metagpt -pip install -e. # 或者 pip3 install metagpt # 安装稳定版本 +pip3 install -e. # 或者 pip3 install metagpt # 安装稳定版本 # 第 4 步:执行startup.py # 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY From 33f0ca2aee7e90021d914b752aa9cd016f7c5a16 Mon Sep 17 00:00:00 2001 From: better629 Date: Mon, 20 Nov 2023 15:04:37 +0800 Subject: [PATCH 12/15] add optional for npm --- README.md | 7 ++++--- docs/README_CN.md | 7 ++++--- docs/README_JA.md | 4 ++-- docs/install/cli_install.md | 4 ++-- docs/install/cli_install_cn.md | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c537e2a3b..1929a8bdd 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ ## Install ### Pip installation ```bash -# Step 1: Ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) +# Step 1 [Optional]: If you want to save the artifacts like PRD in the workspace, you can execute the step. By default, the framework is compatible, and the entire process can be run completely without executing this step. +# If executing, ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) npm --version sudo npm install -g @mermaid-js/mermaid-cli @@ -51,8 +52,8 @@ # conda activate metagpt python3 --version # Step 3: Clone the repository to your local machine for latest version, and install it. -git clone https://github.com/geekan/metagpt -cd metagpt +git clone https://github.com/geekan/MetaGPT.git +cd MetaGPT pip3 install -e. # or pip3 install metagpt # for stable version # Step 4: run the startup.py diff --git a/docs/README_CN.md b/docs/README_CN.md index 22e8358b2..3e0879c1b 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -37,7 +37,8 @@ ## 安装 ### Pip安装 ```bash -# 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js +# 第 1 步【可选的】:如果你想在执行过程中保存像PRD文件这些产物,可以执行该步骤。默认的,框架做了兼容,在不执行该步的情况下,也可以完整跑完整个流程。 +# 如果执行,确保您的系统上安装了 NPM。并使用npm安装mermaid-js npm --version sudo npm install -g @mermaid-js/mermaid-cli @@ -48,8 +49,8 @@ # conda activate metagpt python3 --version # 第 3 步:克隆最新仓库到您的本地机器,并进行安装。 -git clone https://github.com/geekan/metagpt -cd metagpt +git clone https://github.com/geekan/MetaGPT.git +cd MetaGPT pip3 install -e. # 或者 pip3 install metagpt # 安装稳定版本 # 第 4 步:执行startup.py diff --git a/docs/README_JA.md b/docs/README_JA.md index 2b2c35a62..dfb9c8372 100644 --- a/docs/README_JA.md +++ b/docs/README_JA.md @@ -68,8 +68,8 @@ # ステップ 2: Python 3.9+ がシステムにインストールされてい python --version # ステップ 3: リポジトリをローカルマシンにクローンし、インストールする。 -git clone https://github.com/geekan/metagpt -cd metagpt +git clone https://github.com/geekan/MetaGPT.git +cd MetaGPT pip install -e. ``` diff --git a/docs/install/cli_install.md b/docs/install/cli_install.md index 19f0e3c75..80deda771 100644 --- a/docs/install/cli_install.md +++ b/docs/install/cli_install.md @@ -17,8 +17,8 @@ # Step 2: Ensure that Python 3.9+ is installed on your system. You can check thi python3 --version # Step 3: Clone the repository to your local machine, and install it. -git clone https://github.com/geekan/metagpt -cd metagpt +git clone https://github.com/geekan/MetaGPT.git +cd MetaGPT pip install -e. ``` diff --git a/docs/install/cli_install_cn.md b/docs/install/cli_install_cn.md index fe97a0b80..f351090ed 100644 --- a/docs/install/cli_install_cn.md +++ b/docs/install/cli_install_cn.md @@ -18,8 +18,8 @@ # 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下 python --version # 第 3 步:克隆仓库到您的本地机器,并进行安装。 -git clone https://github.com/geekan/metagpt -cd metagpt +git clone https://github.com/geekan/MetaGPT.git +cd MetaGPT pip install -e. ``` From 920caa048aaa85eb47503f6c48f50f0a3af16773 Mon Sep 17 00:00:00 2001 From: better629 Date: Mon, 20 Nov 2023 15:11:55 +0800 Subject: [PATCH 13/15] change step order of pip-install --- README.md | 16 ++++++++-------- docs/README_CN.md | 16 ++++++++-------- docs/README_JA.md | 17 +++++++++++------ 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 1929a8bdd..0606d2be6 100644 --- a/README.md +++ b/README.md @@ -40,25 +40,25 @@ ## Install ### Pip installation ```bash -# Step 1 [Optional]: If you want to save the artifacts like PRD in the workspace, you can execute the step. By default, the framework is compatible, and the entire process can be run completely without executing this step. -# If executing, ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) -npm --version -sudo npm install -g @mermaid-js/mermaid-cli - -# Step 2: Ensure that Python 3.9+ is installed on your system. You can check this by using: +# Step 1: Ensure that Python 3.9+ is installed on your system. You can check this by using: # You can use conda to initialize a new python env # conda create -n metagpt python=3.9 # conda activate metagpt python3 --version -# Step 3: Clone the repository to your local machine for latest version, and install it. +# Step 2: Clone the repository to your local machine for latest version, and install it. git clone https://github.com/geekan/MetaGPT.git cd MetaGPT pip3 install -e. # or pip3 install metagpt # for stable version -# Step 4: run the startup.py +# Step 3: run the startup.py # setup your OPENAI_API_KEY in key.yaml copy from config.yaml python3 startup.py "Write a cli snake game" + +# Step 4 [Optional]: If you want to save the artifacts like PRD in the workspace, you can execute the step before Step 3. By default, the framework is compatible, and the entire process can be run completely without executing this step. +# If executing, ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) +npm --version +sudo npm install -g @mermaid-js/mermaid-cli ``` detail installation please refer to [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-stable-version) diff --git a/docs/README_CN.md b/docs/README_CN.md index 3e0879c1b..d38d6908b 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -37,25 +37,25 @@ ## 安装 ### Pip安装 ```bash -# 第 1 步【可选的】:如果你想在执行过程中保存像PRD文件这些产物,可以执行该步骤。默认的,框架做了兼容,在不执行该步的情况下,也可以完整跑完整个流程。 -# 如果执行,确保您的系统上安装了 NPM。并使用npm安装mermaid-js -npm --version -sudo npm install -g @mermaid-js/mermaid-cli - -# 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查: +# 第 1 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查: # 可以使用conda来初始化新的python环境 # conda create -n metagpt python=3.9 # conda activate metagpt python3 --version -# 第 3 步:克隆最新仓库到您的本地机器,并进行安装。 +# 第 2 步:克隆最新仓库到您的本地机器,并进行安装。 git clone https://github.com/geekan/MetaGPT.git cd MetaGPT pip3 install -e. # 或者 pip3 install metagpt # 安装稳定版本 -# 第 4 步:执行startup.py +# 第 3 步:执行startup.py # 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY python3 startup.py "Write a cli snake game" + +# 第 4 步【可选的】:如果你想在执行过程中保存像PRD文件这些产物,可以在第3步前执行该步骤。默认的,框架做了兼容,在不执行该步的情况下,也可以完整跑完整个流程。 +# 如果执行,确保您的系统上安装了 NPM。并使用npm安装mermaid-js +npm --version +sudo npm install -g @mermaid-js/mermaid-cli ``` 详细的安装请安装 [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-stable-version) diff --git a/docs/README_JA.md b/docs/README_JA.md index dfb9c8372..0a65e83e0 100644 --- a/docs/README_JA.md +++ b/docs/README_JA.md @@ -60,17 +60,22 @@ ### インストールビデオガイド ### 伝統的なインストール ```bash -# ステップ 1: NPM がシステムにインストールされていることを確認してください。次に mermaid-js をインストールします。(お使いのコンピューターに npm がない場合は、Node.js 公式サイトで Node.js https://nodejs.org/ をインストールしてください。) -npm --version -sudo npm install -g @mermaid-js/mermaid-cli - -# ステップ 2: Python 3.9+ がシステムにインストールされていることを確認してください。これを確認するには: +# ステップ 1: Python 3.9+ がシステムにインストールされていることを確認してください。これを確認するには: python --version -# ステップ 3: リポジトリをローカルマシンにクローンし、インストールする。 +# ステップ 2: リポジトリをローカルマシンにクローンし、インストールする。 git clone https://github.com/geekan/MetaGPT.git cd MetaGPT pip install -e. + +# ステップ 3: startup.py を実行する +# config.yaml を key.yaml にコピーし、独自の OPENAI_API_KEY を設定します +python3 startup.py "Write a cli snake game" + +# ステップ 4 [オプション]: 実行中に PRD ファイルなどのアーティファクトを保存する場合は、ステップ 3 の前にこのステップを実行できます。デフォルトでは、フレームワークには互換性があり、この手順を実行しなくてもプロセス全体を完了できます。 +# NPM がシステムにインストールされていることを確認してください。次に mermaid-js をインストールします。(お使いのコンピューターに npm がない場合は、Node.js 公式サイトで Node.js https://nodejs.org/ をインストールしてください。) +npm --version +sudo npm install -g @mermaid-js/mermaid-cli ``` **注:** From fa6621a6996fdef77301f6ccbec08f4f95453514 Mon Sep 17 00:00:00 2001 From: better629 Date: Mon, 20 Nov 2023 15:15:09 +0800 Subject: [PATCH 14/15] rm useless files --- docs/tutorial/faq.md | 6 ------ docs/tutorial/what_can_this_do.md | 0 2 files changed, 6 deletions(-) delete mode 100644 docs/tutorial/faq.md delete mode 100644 docs/tutorial/what_can_this_do.md diff --git a/docs/tutorial/faq.md b/docs/tutorial/faq.md deleted file mode 100644 index 0d2fa7ef0..000000000 --- a/docs/tutorial/faq.md +++ /dev/null @@ -1,6 +0,0 @@ -## FAQs - -### installation - - -### openai usage diff --git a/docs/tutorial/what_can_this_do.md b/docs/tutorial/what_can_this_do.md deleted file mode 100644 index e69de29bb..000000000 From c212c94da35ea80b63749bea536ea7003578a3d3 Mon Sep 17 00:00:00 2001 From: better629 Date: Mon, 20 Nov 2023 15:37:44 +0800 Subject: [PATCH 15/15] fix --- README.md | 2 +- docs/README_CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0606d2be6..a39b509df 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ # Step 3: run the startup.py # setup your OPENAI_API_KEY in key.yaml copy from config.yaml python3 startup.py "Write a cli snake game" -# Step 4 [Optional]: If you want to save the artifacts like PRD in the workspace, you can execute the step before Step 3. By default, the framework is compatible, and the entire process can be run completely without executing this step. +# Step 4 [Optional]: If you want to save the artifacts like diagrams such as quadrant chart, system designs, sequence flow in the workspace, you can execute the step before Step 3. By default, the framework is compatible, and the entire process can be run completely without executing this step. # If executing, ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.) npm --version sudo npm install -g @mermaid-js/mermaid-cli diff --git a/docs/README_CN.md b/docs/README_CN.md index d38d6908b..50cf207b4 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -52,7 +52,7 @@ # 第 3 步:执行startup.py # 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY python3 startup.py "Write a cli snake game" -# 第 4 步【可选的】:如果你想在执行过程中保存像PRD文件这些产物,可以在第3步前执行该步骤。默认的,框架做了兼容,在不执行该步的情况下,也可以完整跑完整个流程。 +# 第 4 步【可选的】:如果你想在执行过程中保存像象限图、系统设计、序列流程等图表这些产物,可以在第3步前执行该步骤。默认的,框架做了兼容,在不执行该步的情况下,也可以完整跑完整个流程。 # 如果执行,确保您的系统上安装了 NPM。并使用npm安装mermaid-js npm --version sudo npm install -g @mermaid-js/mermaid-cli