diff --git a/.agent-store-config.yaml b/.agent-store-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d5d24ee57f9d537f834de0ec2e2636ebfcd62dc7 --- /dev/null +++ b/.agent-store-config.yaml @@ -0,0 +1,8 @@ +role: + name: SoftwareCompany + module: metagpt.roles.software_company + skills: + - name: WritePRD + - name: WriteDesign + - name: WriteTasks + - name: WriteCode diff --git a/.agent-store-config.yaml.example b/.agent-store-config.yaml.example new file mode 100644 index 0000000000000000000000000000000000000000..d12cc6999ee0a0665fae8a9f25a1e44443a3f1b7 --- /dev/null +++ b/.agent-store-config.yaml.example @@ -0,0 +1,9 @@ +role: + name: Teacher # Referenced the `Teacher` in `metagpt/roles/teacher.py`. + module: metagpt.roles.teacher # Referenced `metagpt/roles/teacher.py`. + skills: # Refer to the skill `name` of the published skill in `.well-known/skills.yaml`. + - name: text_to_speech + description: Text-to-speech + - name: text_to_image + description: Create a drawing based on the text. + diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..2968dd34dcdc908cb1353345faa78b10192b378a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +workspace +tmp +build +workspace +dist +data +geckodriver.log diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..cc290fa0b26c571cb01fc9c174a15bed15110127 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +metagpt/static/assets/example-1902a4ef.png filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1a9741e913631b2f5130c0def373fd9895f068b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,171 @@ +### Python template + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python scripts from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# report +allure-report +allure-results + +# idea +.idea +.DS_Store +.vscode + + +*.txt +docs/scripts/set_env.sh +key.yaml +output.json +data +data/output_add.json +data.ms +examples/nb/ +.chroma +*~$* +workspace/* +*.mmd +tmp +output.wav +*.bak + +# output folder +output +tmp.png + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b1892a70907df3da64bffcc2c314f20313971e0a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +default_stages: [ commit ] + +# Install +# 1. pip install pre-commit +# 2. pre-commit install(the first time you download the repo, it will be cached for future use) +repos: + - repo: https://github.com/pycqa/isort + rev: 5.11.5 + hooks: + - id: isort + args: ['--profile', 'black'] + exclude: >- + (?x)^( + .*__init__\.py$ + ) + + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.0.284 + hooks: + - id: ruff + + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + args: ['--line-length', '120'] \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ce39b8eca96a3c5eadc337d2de5254cf31586e7d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Use a base image with Python3.9 and Nodejs20 slim version +FROM nikolaik/python-nodejs:python3.9-nodejs20-slim + +USER root + +# Install Debian software needed by MetaGPT and clean up in one RUN command to reduce image size +RUN apt update &&\ + apt install -y git chromium fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends &&\ + apt clean && rm -rf /var/lib/apt/lists/* + +# Install Mermaid CLI globally +ENV CHROME_BIN="/usr/bin/chromium" \ + PUPPETEER_CONFIG="/app/metagpt/config/puppeteer-config.json"\ + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" +RUN npm install -g @mermaid-js/mermaid-cli &&\ + npm cache clean --force + +# Install Python dependencies and install MetaGPT +COPY requirements.txt requirements.txt + +RUN pip install --no-cache-dir -r requirements.txt + +COPY . /app/metagpt +WORKDIR /app/metagpt +RUN chmod -R 777 /app/metagpt/logs/ &&\ + mkdir workspace &&\ + chmod -R 777 /app/metagpt/workspace/ &&\ + python -m pip install -e. + + +CMD ["python", "metagpt/web/app.py"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5b0c000cde3e4987e655f4cb50cb8b794de3be31 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) Chenglin Wu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index 7be4134a39a17ec2fc585aab2a3b91b6ea2722ac..2f7fe473a1e348220e2943b6053702eabb3290f4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ --- title: MetaGPT -emoji: 🐠 -colorFrom: pink -colorTo: yellow +emoji: 🐼 +colorFrom: green +colorTo: blue sdk: docker +app_file: app.py pinned: false -license: mit --- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0e0380555fd32e6c5c28e468e0244d761d6ae413 --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,86 @@ +# DO NOT MODIFY THIS FILE, create a new key.yaml, define OPENAI_API_KEY. +# The configuration of key.yaml has a higher priority and will not enter git + +#### if OpenAI +## The official OPENAI_API_BASE is https://api.openai.com/v1 +## If the official OPENAI_API_BASE is not available, we recommend using the [openai-forward](https://github.com/beidongjiedeguang/openai-forward). +## Or, you can configure OPENAI_PROXY to access official OPENAI_API_BASE. +OPENAI_API_BASE: "https://api.openai.com/v1" +#OPENAI_PROXY: "http://127.0.0.1:8118" +#OPENAI_API_KEY: "YOUR_API_KEY" +OPENAI_API_MODEL: "gpt-4" +MAX_TOKENS: 1500 +RPM: 10 + +#### if Anthropic +#Anthropic_API_KEY: "YOUR_API_KEY" + +#### if AZURE, check https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb + +#OPENAI_API_TYPE: "azure" +#OPENAI_API_BASE: "YOUR_AZURE_ENDPOINT" +#OPENAI_API_KEY: "YOUR_AZURE_API_KEY" +#OPENAI_API_VERSION: "YOUR_AZURE_API_VERSION" +#DEPLOYMENT_ID: "YOUR_DEPLOYMENT_ID" + +#### for Search + +## Supported values: serpapi/google/serper/ddg +#SEARCH_ENGINE: serpapi + +## Visit https://serpapi.com/ to get key. +#SERPAPI_API_KEY: "YOUR_API_KEY" + +## Visit https://console.cloud.google.com/apis/credentials to get key. +#GOOGLE_API_KEY: "YOUR_API_KEY" +## Visit https://programmablesearchengine.google.com/controlpanel/create to get id. +#GOOGLE_CSE_ID: "YOUR_CSE_ID" + +## Visit https://serper.dev/ to get key. +#SERPER_API_KEY: "YOUR_API_KEY" + +#### for web access + +## Supported values: playwright/selenium +#WEB_BROWSER_ENGINE: playwright + +## Supported values: chromium/firefox/webkit, visit https://playwright.dev/python/docs/api/class-browsertype +##PLAYWRIGHT_BROWSER_TYPE: chromium + +## Supported values: chrome/firefox/edge/ie, visit https://www.selenium.dev/documentation/webdriver/browsers/ +# SELENIUM_BROWSER_TYPE: chrome + +#### for TTS + +#AZURE_TTS_SUBSCRIPTION_KEY: "YOUR_API_KEY" +#AZURE_TTS_REGION: "eastus" + +#### for Stable Diffusion +## Use SD service, based on https://github.com/AUTOMATIC1111/stable-diffusion-webui +SD_URL: "YOUR_SD_URL" +SD_T2I_API: "/sdapi/v1/txt2img" + +#### for Execution +#LONG_TERM_MEMORY: false + +#### for Mermaid CLI +## If you installed mmdc (Mermaid CLI) only for metagpt then enable the following configuration. +#PUPPETEER_CONFIG: "./config/puppeteer-config.json" +#MMDC: "./node_modules/.bin/mmdc" + + +### for calc_usage +# CALC_USAGE: false + +### for Research +MODEL_FOR_RESEARCHER_SUMMARY: gpt-3.5-turbo +MODEL_FOR_RESEARCHER_REPORT: gpt-3.5-turbo-16k + +### Meta Models +#METAGPT_TEXT_TO_IMAGE_MODEL: MODEL_URL + +### S3 config +S3: + access_key: "YOUR_S3_ACCESS_KEY" + secret_key: "YOUR_S3_SECRET_KEY" + endpoint_url: "YOUR_S3_ENDPOINT_URL" diff --git a/config/puppeteer-config.json b/config/puppeteer-config.json new file mode 100644 index 0000000000000000000000000000000000000000..7b2851c2995be43a0f9bc0422c0849fb3e3e41ec --- /dev/null +++ b/config/puppeteer-config.json @@ -0,0 +1,6 @@ +{ + "executablePath": "/usr/bin/chromium", + "args": [ + "--no-sandbox" + ] +} \ No newline at end of file diff --git a/docs/FAQ-EN.md b/docs/FAQ-EN.md new file mode 100644 index 0000000000000000000000000000000000000000..b5ae9184b39cbd61e409a9ab6ca02efd00993a2b --- /dev/null +++ b/docs/FAQ-EN.md @@ -0,0 +1,181 @@ +Our vision is to [extend human life](https://github.com/geekan/HowToLiveLonger) and [reduce working hours](https://github.com/geekan/MetaGPT/). + +1. ### Convenient Link for Sharing this Document: + +``` +- MetaGPT-Index/FAQ https://deepwisdom.feishu.cn/wiki/MsGnwQBjiif9c3koSJNcYaoSnu4 +``` + +2. ### Link + + + +1. Code:https://github.com/geekan/MetaGPT + +1. Roadmap:https://github.com/geekan/MetaGPT/blob/main/docs/ROADMAP.md + +1. EN + + 1. Demo Video: [MetaGPT: Multi-Agent AI Programming Framework](https://www.youtube.com/watch?v=8RNzxZBTW8M) + 1. Tutorial: [MetaGPT: Deploy POWERFUL Autonomous Ai Agents BETTER Than SUPERAGI!](https://www.youtube.com/watch?v=q16Gi9pTG_M&t=659s) + +1. CN + + 1. Demo Video: [MetaGPT:一行代码搭建你的虚拟公司_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1NP411C7GW/?spm_id_from=333.999.0.0&vd_source=735773c218b47da1b4bd1b98a33c5c77) + 1. Tutorial: [一个提示词写游戏 Flappy bird, 比AutoGPT强10倍的MetaGPT,最接近AGI的AI项目](https://youtu.be/Bp95b8yIH5c) + 1. Author's thoughts video(CN): [MetaGPT作者深度解析直播回放_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1Ru411V7XL/?spm_id_from=333.337.search-card.all.click) + + + +3. ### How to become a contributor? + + + +1. Choose a task from the Roadmap (or you can propose one). By submitting a PR, you can become a contributor and join the dev team. +1. Current contributors come from backgrounds including: ByteDance AI Lab/DingDong/Didi/Xiaohongshu, Tencent/Baidu/MSRA/TikTok/BloomGPT Infra/Bilibili/CUHK/HKUST/CMU/UCB + + + +4. ### Chief Evangelist (Monthly Rotation) + +MetaGPT Community - The position of Chief Evangelist rotates on a monthly basis. The primary responsibilities include: + +1. Maintaining community FAQ documents, announcements, Github resources/READMEs. +1. Responding to, answering, and distributing community questions within an average of 30 minutes, including on platforms like Github Issues, Discord and WeChat. +1. Upholding a community atmosphere that is enthusiastic, genuine, and friendly. +1. Encouraging everyone to become contributors and participate in projects that are closely related to achieving AGI (Artificial General Intelligence). +1. (Optional) Organizing small-scale events, such as hackathons. + + + +5. ### FAQ + + + +1. Experience with the generated repo code: + + 1. https://github.com/geekan/MetaGPT/releases/tag/v0.1.0 + +1. Code truncation/ Parsing failure: + + 1. Check if it's due to exceeding length. Consider using the gpt-3.5-turbo-16k or other long token versions. + +1. Success rate: + + 1. There hasn't been a quantitative analysis yet, but the success rate of code generated by GPT-4 is significantly higher than that of gpt-3.5-turbo. + +1. Support for incremental, differential updates (if you wish to continue a half-done task): + + 1. Several prerequisite tasks are listed on the ROADMAP. + +1. Can existing code be loaded? + + 1. It's not on the ROADMAP yet, but there are plans in place. It just requires some time. + +1. Support for multiple programming languages and natural languages? + + 1. It's listed on ROADMAP. + +1. Want to join the contributor team? How to proceed? + + 1. Merging a PR will get you into the contributor's team. The main ongoing tasks are all listed on the ROADMAP. + +1. PRD stuck / unable to access/ connection interrupted + + 1. The official OPENAI_API_BASE address is `https://api.openai.com/v1` + 1. If the official OPENAI_API_BASE address is inaccessible in your environment (this can be verified with curl), it's recommended to configure using the reverse proxy OPENAI_API_BASE provided by libraries such as openai-forward. For instance, `OPENAI_API_BASE: "``https://api.openai-forward.com/v1``"` + 1. If the official OPENAI_API_BASE address is inaccessible in your environment (again, verifiable via curl), another option is to configure the OPENAI_PROXY parameter. This way, you can access the official OPENAI_API_BASE via a local proxy. If you don't need to access via a proxy, please do not enable this configuration; if accessing through a proxy is required, modify it to the correct proxy address. Note that when OPENAI_PROXY is enabled, don't set OPENAI_API_BASE. + 1. Note: OpenAI's default API design ends with a v1. An example of the correct configuration is: `OPENAI_API_BASE: "``https://api.openai.com/v1``"` + +1. Absolutely! How can I assist you today? + + 1. Did you use Chi or a similar service? These services are prone to errors, and it seems that the error rate is higher when consuming 3.5k-4k tokens in GPT-4 + +1. What does Max token mean? + + 1. It's a configuration for OpenAI's maximum response length. If the response exceeds the max token, it will be truncated. + +1. How to change the investment amount? + + 1. You can view all commands by typing `python startup.py --help` + +1. Which version of Python is more stable? + + 1. python3.9 / python3.10 + +1. Can't use GPT-4, getting the error "The model gpt-4 does not exist." + + 1. OpenAI's official requirement: You can use GPT-4 only after spending $1 on OpenAI. + 1. Tip: Run some data with gpt-3.5-turbo (consume the free quota and $1), and then you should be able to use gpt-4. + +1. Can games whose code has never been seen before be written? + + 1. Refer to the README. The recommendation system of Toutiao is one of the most complex systems in the world currently. Although it's not on GitHub, many discussions about it exist online. If it can visualize these, it suggests it can also summarize these discussions and convert them into code. The prompt would be something like "write a recommendation system similar to Toutiao". Note: this was approached in earlier versions of the software. The SOP of those versions was different; the current one adopts Elon Musk's five-step work method, emphasizing trimming down requirements as much as possible. + +1. Under what circumstances would there typically be errors? + + 1. More than 500 lines of code: some function implementations may be left blank. + 1. When using a database, it often gets the implementation wrong — since the SQL database initialization process is usually not in the code. + 1. With more lines of code, there's a higher chance of false impressions, leading to calls to non-existent APIs. + +1. Instructions for using SD Skills/UI Role: + + 1. Currently, there is a test script located in /tests/metagpt/roles. The file ui_role provides the corresponding code implementation. For testing, you can refer to the test_ui in the same directory. + + 1. The UI role takes over from the product manager role, extending the output from the 【UI Design draft】 provided by the product manager role. The UI role has implemented the UIDesign Action. Within the run of UIDesign, it processes the respective context, and based on the set template, outputs the UI. The output from the UI role includes: + + 1. UI Design Description:Describes the content to be designed and the design objectives. + 1. Selected Elements:Describes the elements in the design that need to be illustrated. + 1. HTML Layout:Outputs the HTML code for the page. + 1. CSS Styles (styles.css):Outputs the CSS code for the page. + + 1. Currently, the SD skill is a tool invoked by UIDesign. It instantiates the SDEngine, with specific code found in metagpt/tools/sd_engine. + + 1. Configuration instructions for SD Skills: The SD interface is currently deployed based on *https://github.com/AUTOMATIC1111/stable-diffusion-webui* **For environmental configurations and model downloads, please refer to the aforementioned GitHub repository. To initiate the SD service that supports API calls, run the command specified in cmd with the parameter nowebui, i.e., + + 1. > python webui.py --enable-insecure-extension-access --port xxx --no-gradio-queue --nowebui + 1. Once it runs without errors, the interface will be accessible after approximately 1 minute when the model finishes loading. + 1. Configure SD_URL and SD_T2I_API in the config.yaml/key.yaml files. + 1.  + 1. SD_URL is the deployed server/machine IP, and Port is the specified port above, defaulting to 7860. + 1. > SD_URL: IP:Port + +1. An error occurred during installation: "Another program is using this file...egg". + + 1. Delete the file and try again. + 1. Or manually execute`pip install -r requirements.txt` + +1. The origin of the name MetaGPT? + + 1. The name was derived after iterating with GPT-4 over a dozen rounds. GPT-4 scored and suggested it. + +1. Is there a more step-by-step installation tutorial? + + 1. Youtube(CN):[一个提示词写游戏 Flappy bird, 比AutoGPT强10倍的MetaGPT,最接近AGI的AI项目=一个软件公司产品经理+程序员](https://youtu.be/Bp95b8yIH5c) + 1. Youtube(EN)https://www.youtube.com/watch?v=q16Gi9pTG_M&t=659s + +1. openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details + + 1. If you haven't exhausted your free quota, set RPM to 3 or lower in the settings. + 1. If your free quota is used up, consider adding funds to your account. + +1. What does "borg" mean in n_borg? + + 1. https://en.wikipedia.org/wiki/Borg + 1. The Borg civilization operates based on a hive or collective mentality, known as "the Collective." Every Borg individual is connected to the collective via a sophisticated subspace network, ensuring continuous oversight and guidance for every member. This collective consciousness allows them to not only "share the same thoughts" but also to adapt swiftly to new strategies. While individual members of the collective rarely communicate, the collective "voice" sometimes transmits aboard ships. + +1. How to use the Claude API? + + 1. The full implementation of the Claude API is not provided in the current code. + 1. You can use the Claude API through third-party API conversion projects like: https://github.com/jtsang4/claude-to-chatgpt + +1. Is Llama2 supported? + + 1. On the day Llama2 was released, some of the community members began experiments and found that output can be generated based on MetaGPT's structure. However, Llama2's context is too short to generate a complete project. Before regularly using Llama2, it's necessary to expand the context window to at least 8k. If anyone has good recommendations for expansion models or methods, please leave a comment. + +1. `mermaid-cli getElementsByTagName SyntaxError: Unexpected token '.'` + + 1. Upgrade node to version 14.x or above: + + 1. `npm install -g n` + 1. `n stable` to install the stable version of node(v18.x) diff --git a/docs/README_CN.md b/docs/README_CN.md new file mode 100644 index 0000000000000000000000000000000000000000..2180eb51874ceaa3215331ade42fe8139f130f28 --- /dev/null +++ b/docs/README_CN.md @@ -0,0 +1,201 @@ +# MetaGPT: 多智能体框架 + +
+ ++使 GPTs 组成软件公司,协作处理更复杂的任务 +
+ + + +1. MetaGPT输入**一句话的老板需求**,输出**用户故事 / 竞品分析 / 需求 / 数据结构 / APIs / 文件等** +2. MetaGPT内部包括**产品经理 / 架构师 / 项目经理 / 工程师**,它提供了一个**软件公司**的全过程与精心调配的SOP + 1. `Code = SOP(Team)` 是核心哲学。我们将SOP具象化,并且用于LLM构成的团队 + + + +软件公司多角色示意图(正在逐步实现)
+ +## 示例(均由 GPT-4 生成) + +例如,键入`python startup.py "写个类似今日头条的推荐系统"`并回车,你会获得一系列输出,其一是数据结构与API设计 + + + +这需要大约**0.2美元**(GPT-4 API的费用)来生成一个带有分析和设计的示例,大约2.0美元用于一个完整的项目 + +## 安装 + +### 传统安装 + +```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 +python setup.py install +``` + +### Docker安装 + +```bash +# 步骤1: 下载metagpt官方镜像并准备好config.yaml +docker pull metagpt/metagpt:v0.3 +mkdir -p /opt/metagpt/{config,workspace} +docker run --rm metagpt/metagpt:v0.3 cat /app/metagpt/config/config.yaml > /opt/metagpt/config/config.yaml +vim /opt/metagpt/config/config.yaml # 修改config + +# 步骤2: 使用容器运行metagpt演示 +docker run --rm \ + --privileged \ + -v /opt/metagpt/config:/app/metagpt/config \ + -v /opt/metagpt/workspace:/app/metagpt/workspace \ + metagpt/metagpt:v0.3 \ + python startup.py "Write a cli snake game" + +# 您也可以启动一个容器并在其中执行命令 +docker run --name metagpt -d \ + --privileged \ + -v /opt/metagpt/config:/app/metagpt/config \ + -v /opt/metagpt/workspace:/app/metagpt/workspace \ + metagpt/metagpt:v0.3 + +docker exec -it metagpt /bin/bash +$ python startup.py "Write a cli snake game" +``` + +`docker run ...`做了以下事情: + +- 以特权模式运行,有权限运行浏览器 +- 将主机目录 `/opt/metagpt/config` 映射到容器目录`/app/metagpt/config` +- 将主机目录 `/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:v0.3 . +``` + +## 配置 + +- 在 `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://+GPT にさまざまな役割を割り当てることで、複雑なタスクのための共同ソフトウェアエンティティを形成します。 +
+ + + +1. MetaGPT は、**1 行の要件** を入力とし、**ユーザーストーリー / 競合分析 / 要件 / データ構造 / API / 文書など** を出力します。 +2. MetaGPT には、**プロダクト マネージャー、アーキテクト、プロジェクト マネージャー、エンジニア** が含まれています。MetaGPT は、**ソフトウェア会社のプロセス全体を、慎重に調整された SOP とともに提供します。** + 1. `Code = SOP(Team)` が基本理念です。私たちは SOP を具体化し、LLM で構成されるチームに適用します。 + + + +ソフトウェア会社のマルチロール図式(順次導入)
+ +## 例(GPT-4 で完全生成) + +例えば、`python startup.py "Toutiao のような RecSys をデザインする"`と入力すると、多くの出力が得られます + + + +解析と設計を含む 1 つの例を生成するのに、**$0.2** (GPT-4 の api のコスト)程度、完全なプロジェクトには **$2.0** 程度が必要です。 + +## インストール + +### 伝統的なインストール + +```bash +# ステップ 1: 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 +python setup.py install +``` + +**注:** + +- すでに Chrome、Chromium、MS Edge がインストールされている場合は、環境変数 `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` を `true` に設定することで、 +Chromium のダウンロードをスキップすることができます。 + +- このツールをグローバルにインストールする[問題を抱えている](https://github.com/mermaidjs/mermaid.cli/issues/15)人もいます。ローカルにインストールするのが代替の解決策です、 + + ```bash + npm install @mermaid-js/mermaid-cli + ``` + +- config.yml に mmdc のコンフィギュレーションを記述するのを忘れないこと + + ```yml + PUPPETEER_CONFIG: "./config/puppeteer-config.json" + MMDC: "./node_modules/.bin/mmdc" + ``` + +### Docker によるインストール + +```bash +# ステップ 1: metagpt 公式イメージをダウンロードし、config.yaml を準備する +docker pull metagpt/metagpt:v0.3.1 +mkdir -p /opt/metagpt/{config,workspace} +docker run --rm metagpt/metagpt:v0.3.1 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:v0.3.1 \ + 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:v0.3.1 + +docker exec -it metagpt /bin/bash +$ python startup.py "Write a cli snake game" +``` + +コマンド `docker run ...` は以下のことを行います: + +- 特権モードで実行し、ブラウザの実行権限を得る +- ホストディレクトリ `/opt/metagpt/config` をコンテナディレクトリ `/app/metagpt/config` にマップする +- ホストディレクトリ `/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 . +``` + +## 設定 + +- `OPENAI_API_KEY` を `config/key.yaml / config/config.yaml / env` のいずれかで設定します。 +- 優先順位は: `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://"+ci(t[e].content)+`
+`};Zn.fence=function(t,e,n,i,o){var s=t[e],l=s.info?_ve(s.info).trim():"",c="",d="",_,p,m,E,f;return l&&(m=l.split(/(\s+)/g),c=m[0],d=m.slice(2).join("")),n.highlight?_=n.highlight(s.content,c,d)||ci(s.content):_=ci(s.content),_.indexOf(""+_+`
+`):""+_+`
+`};Zn.image=function(t,e,n,i,o){var s=t[e];return s.attrs[s.attrIndex("alt")][1]=o.renderInlineAsText(s.children,n,i),o.renderToken(t,e,n)};Zn.hardbreak=function(t,e,n){return n.xhtmlOut?`=s||(n=t.src.charCodeAt(o++),n<48||n>57))return-1;for(;;){if(o>=s)return-1;if(n=t.src.charCodeAt(o++),n>=48&&n<=57){if(o-i>=10)return-1;continue}if(n===41||n===46)break;return-1}return o 6||_ _&&vb(e.src.charCodeAt(c-1))&&(p=c),e.line=n+1,d=e.push("heading_open","h"+String(l),1),d.markup="########".slice(0,l),d.map=[n,e.line],d=e.push("inline","",0),d.content=e.src.slice(_,p).trim(),d.map=[n,e.line],d.children=[],d=e.push("heading_close","h"+String(l),-1),d.markup="########".slice(0,l)),!0)},dCe=function(e,n,i){var o,s,l,c,d,_,p,m,E,f=n+1,S,C=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;for(S=e.parentType,e.parentType="paragraph";f3)){if(e.sCount[f]>=e.blkIndent&&(_=e.bMarks[f]+e.tShift[f],p=e.eMarks[f],_ =p)))){m=E===61?1:2;break}if(!(e.sCount[f]<0)){for(s=!1,l=0,c=C.length;l=4||e.listIndent>=0&&e.sCount[n]-e.listIndent>=4&&e.sCount[n]=s)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};so.prototype.parse=function(t,e,n,i){var o,s,l,c=new this.State(t,e,n,i);for(this.tokenize(c),s=this.ruler2.getRules(""),l=s.length,o=0;o