diff --git a/README.md b/README.md index aa273ac88..af2476ff8 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ # MetaGPT: Multi-Agent Meta Programming Framework

CN doc EN doc +JA doc Discord Follow License: MIT roadmap diff --git a/docs/README_CN.md b/docs/README_CN.md index 5e3e28d0c..51140475f 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -11,6 +11,7 @@ # MetaGPT:多智能体元编程框架

CN doc EN doc +JA doc Discord Follow License: MIT roadmap @@ -107,7 +108,4 @@ ## 加入微信讨论群 - 群已满,加人进群 -[//]: # (![MetaGPT WeChat Discuss Group](./resources/MetaGPT-WeChat-Group.jpeg){:height="50%" width="50%"}) MetaGPT WeChat Discuss Group - - diff --git a/docs/README_JA.md b/docs/README_JA.md new file mode 100644 index 000000000..879e22864 --- /dev/null +++ b/docs/README_JA.md @@ -0,0 +1,105 @@ +# MetaGPT: マルチエージェントメタプログラミングフレームワーク + +

+MetaGPT ロゴ: GPT がソフトウェア会社で働けるようにし、協力してより複雑な仕事に取り組む。 +

+ +

+GPT にさまざまな役割を割り当てることで、複雑なタスクのための共同ソフトウェアエンティティを形成します。 +

+ +

+CN doc +EN doc +JA doc +Discord Follow +License: MIT +roadmap +roadmap +Twitter Follow +

+ +1. MetaGPT は、**1 行の要件** を入力とし、**ユーザーストーリー / 競合分析 / 要件 / データ構造 / API / 文書など** を出力します。 +2. MetaGPT には、**プロダクト マネージャー、アーキテクト、プロジェクト マネージャー、エンジニア** が含まれています。MetaGPT は、**ソフトウェア会社のプロセス全体を、慎重に調整された SOP とともに提供します。** + 1. `Code = SOP(Team)` が基本理念です。私たちは SOP を具体化し、LLM で構成されるチームに適用します。 + +![ソフトウェア会社は LLM ベースの役割で構成されている](resources/software_company_cd.jpeg) + +

ソフトウェア会社のマルチロール図式(順次導入)

+ +## 例(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:///v1" | export OPENAI_API_BASE="https:///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 diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 7c57c42ac..e007d08a9 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -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 diff --git a/metagpt/config.py b/metagpt/config.py index 2173f9b67..7308f3cf8 100644 --- a/metagpt/config.py +++ b/metagpt/config.py @@ -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() diff --git a/metagpt/const.py b/metagpt/const.py index ca9aed89d..0f51a6061 100644 --- a/metagpt/const.py +++ b/metagpt/const.py @@ -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: diff --git a/metagpt/environment.py b/metagpt/environment.py index 7e4e6e257..fea6c0ecf 100644 --- a/metagpt/environment.py +++ b/metagpt/environment.py @@ -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}" diff --git a/metagpt/software_company.py b/metagpt/software_company.py index acc2659e3..dab8865ba 100644 --- a/metagpt/software_company.py +++ b/metagpt/software_company.py @@ -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