Merge branch 'geekan:main' into main

This commit is contained in:
Kobayashi 2023-07-07 13:13:04 +08:00 committed by GitHub
commit 96d4f7e379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 148 additions and 30 deletions

View file

@ -11,6 +11,7 @@ # MetaGPT: Multi-Agent Meta Programming Framework
<p align="center">
<a href="docs/README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
<a href="README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
<a href="docs/README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
<a href="https://discord.gg/wCp6Q3fsAk"><img src="https://dcbadge.vercel.app/api/server/wCp6Q3fsAk?compact=true&style=flat" alt="Discord Follow"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
<a href="docs/ROADMAP.md"><img src="https://img.shields.io/badge/ROADMAP-路线图-blue" alt="roadmap"></a>

View file

@ -11,6 +11,7 @@ # MetaGPT多智能体元编程框架
<p align="center">
<a href="README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
<a href="../README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
<a href="README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
<a href="https://discord.gg/wCp6Q3fsAk"><img src="https://dcbadge.vercel.app/api/server/wCp6Q3fsAk?compact=true&style=flat" alt="Discord Follow"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
<a href="ROADMAP.md"><img src="https://img.shields.io/badge/ROADMAP-路线图-blue" alt="roadmap"></a>
@ -107,7 +108,4 @@ ## 加入微信讨论群
- 群已满,加人进群
[//]: # (![MetaGPT WeChat Discuss Group]&#40;./resources/MetaGPT-WeChat-Group.jpeg&#41;{:height="50%" width="50%"})
<img src="resources/MetaGPT-WeChat-Personal.jpeg" width = "30%" height = "30%" alt="MetaGPT WeChat Discuss Group" align=center />

105
docs/README_JA.md Normal file
View file

@ -0,0 +1,105 @@
# MetaGPT: マルチエージェントメタプログラミングフレームワーク
<p align="center">
<a href=""><img src="resources/MetaGPT-logo.jpeg" alt="MetaGPT ロゴ: GPT がソフトウェア会社で働けるようにし、協力してより複雑な仕事に取り組む。" width="150px"></a>
</p>
<p align="center">
<b>GPT にさまざまな役割を割り当てることで、複雑なタスクのための共同ソフトウェアエンティティを形成します。</b>
</p>
<p align="center">
<a href="README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
<a href="../README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
<a href="README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
<a href="https://discord.gg/wCp6Q3fsAk"><img src="https://dcbadge.vercel.app/api/server/wCp6Q3fsAk?compact=true&style=flat" alt="Discord Follow"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
<a href="docs/ROADMAP.md"><img src="https://img.shields.io/badge/ROADMAP-路线图-blue" alt="roadmap"></a>
<a href="resources/MetaGPT-WeChat-Personal.jpeg"><img src="https://img.shields.io/badge/WeChat-微信-blue" alt="roadmap"></a>
<a href="https://twitter.com/DeepWisdom2019"><img src="https://img.shields.io/twitter/follow/MetaGPT?style=social" alt="Twitter Follow"></a>
</p>
1. MetaGPT は、**1 行の要件** を入力とし、**ユーザーストーリー / 競合分析 / 要件 / データ構造 / API / 文書など** を出力します。
2. MetaGPT には、**プロダクト マネージャー、アーキテクト、プロジェクト マネージャー、エンジニア** が含まれています。MetaGPT は、**ソフトウェア会社のプロセス全体を、慎重に調整された SOP とともに提供します。**
1. `Code = SOP(Team)` が基本理念です。私たちは SOP を具体化し、LLM で構成されるチームに適用します。
![ソフトウェア会社は LLM ベースの役割で構成されている](resources/software_company_cd.jpeg)
<p align="center">ソフトウェア会社のマルチロール図式(順次導入)</p>
## 例GPT-4 で完全生成)
例えば、`python startup.py "Toutiao のような RecSys をデザインする"`と入力すると、多くの出力が得られます
![Jinri Toutiao Recsys データと API デザイン](resources/workspace/content_rec_sys/resources/data_api_design.png)
解析と設計を含む 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
```
## 設定
- `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://<YOUR_SITE>/v1" | export OPENAI_API_BASE="https://<YOUR_SITE>/v1" |
## チュートリアル: スタートアップの開始
```shell
python startup.py "Write a cli snake game"
```
スクリプトを実行すると、`workspace/` ディレクトリに新しいプロジェクトが見つかります。
### コードウォークスルー
```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 のみの例を詳しく見ることができます。
## お問い合わせ先
このプロジェクトに関するご質問やご意見がございましたら、お気軽にお問い合わせください。皆様のご意見をお待ちしております!
- **Email:** alexanderwu@fuzhi.ai
- **GitHub Issues:** 技術的なお問い合わせについては、[GitHub リポジトリ](https://github.com/geekan/metagpt/issues) に新しい issue を作成することもできます。
ご質問には 2-3 営業日以内に回答いたします。
## デモ
https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d

View file

@ -55,23 +55,28 @@ ### Tasks
15. Implementation: Run code
16. Implementation: Web access
5. Plugins: Compatibility with plugin system
6. Roles
6. Tools
1. Support SERPER api
2. Support Selenium apis
3. Support Playwright apis
7. Roles
1. Perfect the action pool/skill pool for each role
2. Red Book blogger
3. E-commerce seller
4. Data analyst
5. News observer
6. Institutional researcher
7. Evaluation
8. Evaluation
1. Support an evaluation on a game dataset
2. Reproduce papers, implement full skill acquisition for a single game role, achieving SOTA results
3. Support an evaluation on a math dataset
4. Reproduce papers, achieving SOTA results for current mathematical problem solving process
8. LLM
9. LLM
1. Support Claude underlying API
2. Support Azure asynchronous API
3. Support streaming version of all APIs
9. Other
1. Clean up existing unused code
2. Unify all code styles and establish contribution standards
3. Multi-language support
4. Make gpt-3.5-turbo available (HARD)
10. Other
1. Clean up existing unused code
2. Unify all code styles and establish contribution standards
3. Multi-language support

View file

@ -57,7 +57,7 @@ class Config(metaclass=Singleton):
self.google_api_key = self._get('GOOGLE_API_KEY')
self.google_cse_id = self._get('GOOGLE_CSE_ID')
self.search_engine = self._get('SEARCH_ENGINE', SearchEngineType.SERPAPI_GOOGLE)
self.max_budget = self._get('MAX_BUDGET', 10)
self.max_budget = self._get('MAX_BUDGET', 10.0)
self.total_cost = 0.0
def _init_with_config_files_and_env(self, configs: dict, yaml_file):
@ -85,3 +85,6 @@ class Config(metaclass=Singleton):
if value is None:
raise ValueError(f"Key '{key}' not found in environment variables or in the YAML file")
return value
CONFIG = Config()

View file

@ -13,7 +13,8 @@ def get_project_root():
current_path = Path.cwd()
while True:
if (current_path / '.git').exists() or \
(current_path / '.project_root').exists():
(current_path / '.project_root').exists() or \
(current_path.name.lower() == 'metagpt'):
return current_path
parent_path = current_path.parent
if parent_path == current_path:

View file

@ -19,7 +19,7 @@ class Environment:
"""环境,承载一批角色,角色可以向环境发布消息,可以被其他角色观察到"""
def __init__(self):
self.roles: dict[str, Role] = {}
self.message_queue = Queue()
# self.message_queue = Queue()
self.memory = Memory()
self.history = ''
@ -39,7 +39,7 @@ class Environment:
def publish_message(self, message: Message):
"""向当前环境发布信息"""
self.message_queue.put(message)
# self.message_queue.put(message)
self.memory.add(message)
self.history += f"\n{message}"

View file

@ -5,8 +5,9 @@
@Author : alexanderwu
@File : software_company.py
"""
from pydantic import BaseModel
from metagpt.config import Config
from metagpt.config import CONFIG
from metagpt.actions import BossRequirement
from metagpt.logs import logger
from metagpt.environment import Environment
@ -15,16 +16,17 @@ from metagpt.schema import Message
from metagpt.utils.common import NoMoneyException
class SoftwareCompany:
class SoftwareCompany(BaseModel):
"""
Software Company: Possesses a team, SOP (Standard Operating Procedures), and a platform for instant messaging,
dedicated to writing executable code.
"""
def __init__(self):
self.environment = Environment()
self.config = Config()
self.investment = 0
self.idea = ""
environment: Environment = Environment()
investment: float = 0
idea: str = ""
class Config:
arbitrary_types_allowed = True
def hire(self, roles: list[Role]):
"""Hire roles to cooperate"""
@ -33,24 +35,27 @@ class SoftwareCompany:
def invest(self, investment: float):
"""Invest company. raise NoMoneyException when exceed max_budget."""
self.investment = investment
self.config.max_budget = investment
CONFIG.max_budget = investment
logger.info(f'Investment: ${investment}.')
def _check_balance(self):
if self.config.total_cost > self.config.max_budget:
raise NoMoneyException(self.config.total_cost, f'Insufficient funds: {self.config.max_budget}')
if CONFIG.total_cost > CONFIG.max_budget:
raise NoMoneyException(CONFIG.total_cost, f'Insufficient funds: {CONFIG.max_budget}')
def start_project(self, idea):
"""Start a project from publish boss requirement."""
"""Start a project from publishing boss requirement."""
self.idea = idea
self.environment.publish_message(Message(role="BOSS", content=idea, cause_by=BossRequirement))
def _save(self):
logger.info(self.json())
async def run(self, n_round=3):
"""Run company until target round"""
while not self.environment.message_queue.empty():
self._check_balance()
"""Run company until target round or no money"""
while n_round > 0:
# self._save()
n_round -= 1
logger.debug(f"{n_round=}")
if n_round == 0:
return
self._check_balance()
await self.environment.run()
return self.environment.history