Giter VIP home page Giter VIP logo

metagpt's Introduction

MetaGPT: The Multi-Agent Framework

MetaGPT logo: Enable GPT to work in software company, collaborating to tackle more complex tasks.

Assign different roles to GPTs to form a collaborative entity for complex tasks.

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

Open in Dev Containers Open in GitHub Codespaces Hugging Face

News

🚀 Mar. 14, 2024: Our Data Interpreter paper is on arxiv. Check the example and code!

🚀 Feb. 08, 2024: v0.7.0 released, supporting assigning different LLMs to different Roles. We also introduced Data Interpreter, a powerful agent capable of solving a wide range of real-world problems.

🚀 Jan. 16, 2024: Our paper MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework accepted for oral presentation (top 1.2%) at ICLR 2024, ranking #1 in the LLM-based Agent category.

🚀 Jan. 03, 2024: v0.6.0 released, new features include serialization, upgraded OpenAI package and supported multiple LLM, provided minimal example for debate etc.

🚀 Dec. 15, 2023: v0.5.0 released, introducing some experimental features such as incremental development, multilingual, multiple programming languages, etc.

🔥 Nov. 08, 2023: MetaGPT is selected into Open100: Top 100 Open Source achievements.

🔥 Sep. 01, 2023: MetaGPT tops GitHub Trending Monthly for the 17th time in August 2023.

🌟 Jun. 30, 2023: MetaGPT is now open source.

🌟 Apr. 24, 2023: First line of MetaGPT code committed.

Software Company as Multi-Agent System

  1. MetaGPT takes a one line requirement as input and outputs user stories / competitive analysis / requirements / data structures / APIs / documents, etc.
  2. Internally, MetaGPT includes product managers / architects / project managers / engineers. It provides the entire process of a software company along with carefully orchestrated SOPs.
    1. Code = SOP(Team) is the core philosophy. We materialize SOP and apply it to teams composed of LLMs.

A software company consists of LLM-based roles

Software Company Multi-Agent Schematic (Gradually Implementing)

Install

Pip installation

Ensure that Python 3.9+ is installed on your system. You can check this by using: python --version.
You can use conda like this: conda create -n metagpt python=3.9 && conda activate metagpt

pip install metagpt
# https://docs.deepwisdom.ai/main/en/guide/get_started/configuration.html
metagpt --init-config  # it will create ~/.metagpt/config2.yaml, just modify it to your needs

Configuration

You can configure ~/.metagpt/config2.yaml according to the example and doc:

llm:
  api_type: "openai"  # or azure / ollama / open_llm etc. Check LLMType for more options
  model: "gpt-4-turbo-preview"  # or gpt-3.5-turbo-1106 / gpt-4-1106-preview
  base_url: "https://api.openai.com/v1"  # or forward url / other llm url
  api_key: "YOUR_API_KEY"

Usage

After installation, you can use it as CLI

metagpt "Create a 2048 game"  # this will create a repo in ./workspace

or you can use it as library

from metagpt.software_company import generate_repo, ProjectRepo
repo: ProjectRepo = generate_repo("Create a 2048 game")  # or ProjectRepo("<path>")
print(repo)  # it will print the repo structure with files

detail installation please refer to cli_install or docker_install

Docker installation

⏬ Step 1: Download metagpt image and prepare config2.yaml :: click to expand ::
docker pull metagpt/metagpt:latest
mkdir -p /opt/metagpt/{config,workspace}
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config2.yaml > /opt/metagpt/config/config2.yaml
vim /opt/metagpt/config/config2.yaml # Change the config
⏬ Step 2: Run metagpt container :: click to expand ::
docker run --name metagpt -d \
    --privileged \
    -v /opt/metagpt/config/config2.yaml:/app/metagpt/config/config2.yaml \
    -v /opt/metagpt/workspace:/app/metagpt/workspace \
    metagpt/metagpt:latest
⏬ Step 3: Use metagpt :: click to expand ::
docker exec -it metagpt /bin/bash
$ metagpt "Create a 2048 game"  # this will create a repo in ./workspace

QuickStart & Demo Video

customized_tasks_by_MetaGPT_v2.mp4

Tutorial

Support

Discard Join US

📢 Join Our Discord Channel!

Looking forward to seeing you there! 🎉

Contact Information

If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions!

We will respond to all questions within 2-3 business days.

Citation

If you use MetaGPT or Data Interpreter in a research paper, please cite our work as follows:

@misc{hong2023metagpt,
      title={MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework}, 
      author={Sirui Hong and Mingchen Zhuge and Jonathan Chen and Xiawu Zheng and Yuheng Cheng and Ceyao Zhang and Jinlin Wang and Zili Wang and Steven Ka Shing Yau and Zijuan Lin and Liyang Zhou and Chenyu Ran and Lingfeng Xiao and Chenglin Wu and Jürgen Schmidhuber},
      year={2023},
      eprint={2308.00352},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}
@misc{hong2024data,
      title={Data Interpreter: An LLM Agent For Data Science}, 
      author={Sirui Hong and Yizhang Lin and Bang Liu and Bangbang Liu and Binhao Wu and Danyang Li and Jiaqi Chen and Jiayi Zhang and Jinlin Wang and Li Zhang and Lingyao Zhang and Min Yang and Mingchen Zhuge and Taicheng Guo and Tuo Zhou and Wei Tao and Wenyi Wang and Xiangru Tang and Xiangtao Lu and Xiawu Zheng and Xinbing Liang and Yaying Fei and Yuheng Cheng and Zongze Xu and Chenglin Wu},
      year={2024},
      eprint={2402.18679},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}

metagpt's People

Contributors

abhishek0075 avatar alitrack avatar arnaudgelas avatar better629 avatar brucemeek avatar chenvadder avatar devxiaolan avatar eltociear avatar femto avatar flyi avatar garylin2099 avatar geekan avatar hezhaozhao-git avatar huzixia avatar iorisa avatar justin-zl avatar leonzh0u avatar mannaandpoem avatar martcpp avatar oopsyoudiede avatar orange-crow avatar sablin39 avatar seehi avatar send18 avatar shenchucheng avatar stellahsr avatar stitch-z avatar voidking avatar weburnit avatar yangqianli92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metagpt's Issues

raceback (most recent call last): File "/app/metagpt/startup.py", line 5, in <module> from metagpt.software_company import SoftwareCompany File "/app/metagpt/metagpt/software_company.py", line 10, in <module> from metagpt.config import CONFIG File "/app/metagpt/metagpt/config.py", line 10, in <module> from metagpt.logs import logger File "/app/metagpt/metagpt/logs.py", line 11, in <module> from metagpt.const import PROJECT_ROOT File "/app/metagpt/metagpt/const.py", line 25, in <module> PROJECT_ROOT = get_project_root() File "/app/metagpt/metagpt/const.py", line 21, in get_project_root raise Exception("Project root not found.") Exception: Project root not found.

docker not workinyt help

Times out at "Generating single mermaid chart" stage

Hi,

First of all, nice repo! I've been using gpt-engineer a fair bit and just heard about metagpt so I thought I'd try it out. Unfortunately the program doesn't seem to be able to get past the "Generating single mermaid chart" step. I've ensured that mermaid-chart is installed globally via NPM and everything so I'm not sure what the issue is. The program runs fine and outputs the Implementation approach, package name, file list, data structures and interface definitions as well as the Program call flow. However when it gets to "Generating single mermaid chart" it just hangs after printing that for around 5mins and then outputs the following:

ProtocolError: Page.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
    at new Callback (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:58:35)
    at CallbackRegistry.create (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:103:26)      
    at Connection._rawSend (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:212:26)
    at CDPSessionImpl.send (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:419:78)
    at FrameManager.initialize (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js:133:24)    
    at CDPPage._CDPPage_initialize (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js:834:70)        
    at CDPPage._create (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js:57:90)
    at file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js:125:32
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Target.page (file:///home/me/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js:128:23)

And then it tries to generate the mermaid chart again and again but fails each time with the same error output. Any idea what's wrong? Any help would be appreciated. Thanks,

Development not completed after all the work is done.

Hi, I had no issues during the run for this statement:
metagpt@0833f6fb03f7:/app/metagpt$ python startup.py "create a snake game that will be in a separate window and then snake will be in orange colour. When snake hits the wall the game is over."

MetaGPT created everything that is necessary and that was in its "thinking flow":
image
image

However, when I try to run the game by "python main.py" it opens a command line window for a split second and closes it. Nothing else is going on.

Can you please try it on your end with the same statement as I put?

提示这个错误是不是没有走系统代理,我设置全局也是这个错误,是不是需要改动代码才能走代理呢?

python .\startup.py "Write a Snake Game"
2023-07-09 00:50:19.406 | INFO | metagpt.config:init:43 - Config loading done.
2023-07-09 00:50:19.408 | INFO | metagpt.config:init:49 - Set OPENAI_API_BASE in case of network issues
2023-07-09 00:50:21.142 | INFO | metagpt.software_company:invest:39 - Investment: $3.0.
2023-07-09 00:50:21.144 | INFO | metagpt.roles.role:_act:153 - Alice(Product Manager): ready to WritePRD
Traceback (most recent call last):
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 1056, in create_connection
raise exceptions[0]
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 1041, in create_connection
sock = await self._connect_sock(
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 955, in _connect_sock
await self.sock_connect(sock, address)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\proactor_events.py", line 702, in sock_connect
return await self._proactor.connect(sock, address)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\windows_events.py", line 812, in _poll
value = callback(transferred, key, ov)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\windows_events.py", line 599, in finish_connect
ov.getresult()
OSError: [WinError 121] 信号灯超时时间已到

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_requestor.py", line 668, in arequest_raw
result = await session.request(**request_kwargs)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\client.py", line 536, in _request
conn = await self._connector.connect(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 1206, in _create_direct_connection
raise last_exc
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 988, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.openai.com:443 ssl:default [信号灯超时时间已到]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\GPT\MetaGPT\startup.py", line 29, in
fire.Fire(main)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\fire\core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "D:\GPT\MetaGPT\startup.py", line 25, in main
asyncio.run(startup(idea, investment, n_round))
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "D:\GPT\MetaGPT\startup.py", line 15, in startup
await company.run(n_round=n_round)
File "D:\GPT\MetaGPT\metagpt\software_company.py", line 60, in run
await self.environment.run()
File "D:\GPT\MetaGPT\metagpt\environment.py", line 58, in run
await asyncio.gather(*futures)
File "D:\GPT\MetaGPT\metagpt\roles\role.py", line 223, in run
rsp = await self._react()
File "D:\GPT\MetaGPT\metagpt\roles\role.py", line 194, in _react
return await self._act()
File "D:\GPT\MetaGPT\metagpt\roles\role.py", line 154, in _act
response = await self._rc.todo.run(self._rc.important_memory)
File "D:\GPT\MetaGPT\metagpt\actions\write_prd.py", line 69, in run
rsp = await sas.run(context=requirements, system_text=SEARCH_AND_SUMMARIZE_SYSTEM_EN_US)
File "D:\GPT\MetaGPT\metagpt\actions\search_and_summarize.py", line 135, in run
result = await self._aask(prompt, system_prompt)
File "D:\GPT\MetaGPT\metagpt\actions\action.py", line 41, in _aask
return await self.llm.aask(prompt, system_msgs)
File "D:\GPT\MetaGPT\metagpt\provider\base_gpt_api.py", line 44, in aask
rsp = await self.acompletion_text(message, stream=True)
File "D:\GPT\MetaGPT\metagpt\provider\openai_api.py", line 27, in wrapper
return await f(*args, **kwargs)
File "D:\GPT\MetaGPT\metagpt\provider\openai_api.py", line 213, in acompletion_text
return await self._achat_completion_stream(messages)
File "D:\GPT\MetaGPT\metagpt\provider\openai_api.py", line 146, in _achat_completion_stream
response = await openai.ChatCompletion.acreate(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_resources\chat_completion.py", line 45, in acreate
return await super().acreate(*args, **kwargs)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 217, in acreate
response, _, api_key = await requestor.arequest(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_requestor.py", line 372, in arequest
result = await self.arequest_raw(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_requestor.py", line 685, in arequest_raw
raise error.APIConnectionError("Error communicating with OpenAI") from e
openai.error.APIConnectionError: Error communicating with OpenAI

adapt gpt plus?

Can use GPT plus be adapted for GPT-4, such as using OpenAI tokens for implementation, or something similar to Pandora (https://github.com/pengzhile/pandora), to call Pandora's interface? If not, can you provide an interface so that we can adapt it ourselves? The GPT-4 API is just too expensive.

Error communicating with openai

File "/Users/r/Documents/1-projects/MetaGPT/venv/lib/python3.11/site-packages/aiohttp/connector.py", line 982, in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]

I've checked that I have correct CA Bundle certificates and I can connect to api.openai.com easily

对开发环境有什么要求吗。

Debian GNU/Linux 11
gcc version 10.2.1 20210110 (Debian 10.2.1-6)
执行python setup.py install

aiohttp/_http_parser.c:12057:148: note: expected ‘char *’ but argument is of type ‘const char *’
aiohttp/_http_parser.c: In function ‘__pyx_tp_dealloc_7aiohttp_12_http_parser_HttpParser’:
aiohttp/_http_parser.c:16227:5: error: lvalue required as increment operand
16227 | ++Py_REFCNT(o);
| ^~
aiohttp/_http_parser.c:16229:5: error: lvalue required as decrement operand
16229 | --Py_REFCNT(o);
| ^~
aiohttp/_http_parser.c: In function ‘__Pyx_decode_c_bytes’:
aiohttp/_http_parser.c:19932:9: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]

mac 运行程序失败

hello,我使用的是mac m1的电脑,现在执行该程序,发现mac缺失mmdc命令,想问一下,后续会考虑兼容mac电脑吗?
异常如下:
Traceback (most recent call last):
File "/Users/ysc/Dev_Env/python/MetaGPT/startup.py", line 34, in
fire.Fire(main)
File "/Users/ysc/Library/Python/3.9/lib/python/site-packages/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/Users/ysc/Library/Python/3.9/lib/python/site-packages/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/Users/ysc/Library/Python/3.9/lib/python/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/Users/ysc/Dev_Env/python/MetaGPT/startup.py", line 30, in main
asyncio.run(startup(idea, investment))
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/ysc/Dev_Env/python/MetaGPT/startup.py", line 20, in startup
await company.run(n_round=n_round)
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/software_company.py", line 60, in run
await self.environment.run()
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/environment.py", line 58, in run
await asyncio.gather(*futures)
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/roles/role.py", line 222, in run
rsp = await self._react()
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/roles/role.py", line 193, in _react
return await self._act()
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/roles/role.py", line 153, in _act
response = await self._rc.todo.run(self._rc.important_memory)
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/actions/design_api.py", line 83, in run
self._save(context, system_design)
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/actions/design_api.py", line 77, in _save
self._save_prd(docs_path, resources_path, context[-1].content)
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/actions/design_api.py", line 58, in _save_prd
mermaid_to_file(quadrant_chart, resources_path / 'competitive_analysis')
File "/Users/ysc/Dev_Env/python/MetaGPT/metagpt/utils/common.py", line 129, in mermaid_to_file
subprocess.run(['mmdc', '-i', str(tmp), '-o', output_file, '-w', str(width), '-H', str(height)])
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mmdc'

Some Errors of MetaGPT-Generated applications I met

Hi I am trying to use MetaGPT to generate some applications. However, I often come across issues regarding package dependency or ImportError when running those applications. So I can't even run the application successfully.

For example,

python startup.py "Write a diary web app called my_diary, where the user can keep record of everyday things."

The requirements of the generated app is

flask==1.1.2
flask_sqlalchemy==2.5.1
flask_wtf==0.14.3
flask_login==0.5.0
flask_bcrypt==0.7.1

When I run python main.py, the error is

Traceback (most recent call last):
  File "C:\Users\...\workspace\my_diary\my_diary\main.py", line 3, in <module>
    from flask import Flask, render_template, url_for, flash, redirect
  File "C:\Users\...\workspace\my_diary\env\Lib\site-packages\flask\__init__.py", line 14, in <module>
    from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (C:\Users\v-yaokangwu\Documents\LLM_CodeRevision\workspace\my_diary\env\Lib\site-packages\jinja2\__init__.py)

Another example,

python startup.py "Write a backend restful api based on FastAPI for course CRUD"

The requirements of the generated app is

fastapi==0.68.1
sqlalchemy==1.4.25
pydantic==1.8.2

When I run python main.py, the error is

Traceback (most recent call last):
  File "C:\Users\...\workspace\book_management_api\book_management_api\main.py", line 3, in <module>
    from fastapi import FastAPI, Depends, HTTPException
  File "C:\Users\...\workspace\book_management_api\env\Lib\site-packages\fastapi\__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "C:\Users\...\workspace\book_management_api\env\Lib\site-packages\fastapi\applications.py", line 3, in <module>      
    from fastapi import routing
    ....
  File "C:\Users\...\workspace\book_management_api\env\Lib\site-packages\pydantic\main.py", line 369, in __new__
    cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\workspace\book_management_api\env\Lib\site-packages\pydantic\utils.py", line 231, in generate_model_signature
    merged_params[param_name] = Parameter(
                                ^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1008.0_x64__qbz5n2kfra8p0\Lib\inspect.py", line 2722, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'not' is not a valid parameter name

I wonder if you have also encountered issues like these.

TypeError: issubclass() arg 1 must be a class when running startup.py

Hello,

I've been encountering an issue while running the startup.py script in my project. When I try to run the script with the command python startup.py "write a snake game", the script fails with the following traceback:

Traceback (most recent call last):
File "/home/lidenghui/MetaGPT/startup.py", line 5, in
from metagpt.software_company import SoftwareCompany
File "/home/lidenghui/MetaGPT/metagpt/software_company.py", line 11, in
from metagpt.actions import BossRequirement
File "/home/lidenghui/MetaGPT/metagpt/actions/init.py", line 14, in
from metagpt.actions.design_api import WriteDesign
File "/home/lidenghui/MetaGPT/metagpt/actions/design_api.py", line 13, in
from metagpt.utils.common import CodeParser
File "/home/lidenghui/MetaGPT/metagpt/utils/common.py", line 15, in
from langchain.schema import AgentAction, AgentFinish, OutputParserException
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/init.py", line 6, in
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/agents/init.py", line 2, in
from langchain.agents.agent import (
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/agents/agent.py", line 16, in
from langchain.agents.tools import InvalidTool
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/agents/tools.py", line 8, in
from langchain.tools.base import BaseTool, Tool, tool
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/tools/init.py", line 3, in
from langchain.tools.arxiv.tool import ArxivQueryRun
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/tools/arxiv/tool.py", line 12, in
from langchain.utilities.arxiv import ArxivAPIWrapper
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/utilities/init.py", line 3, in
from langchain.utilities.apify import ApifyWrapper
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/utilities/apify.py", line 5, in
from langchain.document_loaders import ApifyDatasetLoader
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/document_loaders/init.py", line 44, in
from langchain.document_loaders.embaas import EmbaasBlobLoader, EmbaasLoader
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/site-packages/langchain/document_loaders/embaas.py", line 54, in
class BaseEmbaasLoader(BaseModel):
File "pydantic/main.py", line 204, in pydantic.main.ModelMetaclass.new
File "pydantic/fields.py", line 488, in pydantic.fields.ModelField.infer
File "pydantic/fields.py", line 419, in pydantic.fields.ModelField.init
File "pydantic/fields.py", line 539, in pydantic.fields.ModelField.prepare
File "pydantic/fields.py", line 801, in pydantic.fields.ModelField.populate_validators
File "pydantic/validators.py", line 696, in find_validators
File "pydantic/validators.py", line 585, in pydantic.validators.make_typeddict_validator
File "pydantic/annotated_types.py", line 35, in pydantic.annotated_types.create_model_from_typeddict
File "pydantic/main.py", line 972, in pydantic.main.create_model
File "pydantic/main.py", line 204, in pydantic.main.ModelMetaclass.new
File "pydantic/fields.py", line 488, in pydantic.fields.ModelField.infer
File "pydantic/fields.py", line 419, in pydantic.fields.ModelField.init
File "pydantic/fields.py", line 534, in pydantic.fields.ModelField.prepare
File "pydantic/fields.py", line 638, in pydantic.fields.ModelField._type_analysis
File "/home/lidenghui/lou/conda/envs/metagptenv/lib/python3.9/typing.py", line 852, in subclasscheck
return issubclass(cls, self.origin)
TypeError: issubclass() arg 1 must be a class

The error seems to originate from typing.py and is related to issubclass(). The error message indicates that issubclass() was called with an argument that is not a class. The error is potentially linked to the pydantic library.

I've checked my code for any instances where I may be using a non-class argument as a class, but I couldn't find any such cases. I'm also using the latest versions of pydantic and all other relevant libraries.

Can you please provide any guidance on how to resolve this issue, or can you point out where I might be going wrong? Your help would be greatly appreciated.

Sent from PPHub

ModuleNotFoundError: No module named 'termcolor'

Ran through the installation steps. Noticed that after running the install command, I see the following error at the very end:
error: Setup script exited with error: command 'swig.exe' failed: None

No biggie. But when I run the startup.py with a command, I get the following:

Traceback (most recent call last):
  File "C:\Users\kerna\source\repos\metagpt\startup.py", line 4, in <module>
    import fire
  File "C:\Python310\lib\site-packages\fire-0.5.0-py3.10.egg\fire\__init__.py", line 21, in <module>
    from fire.core import Fire
  File "C:\Python310\lib\site-packages\fire-0.5.0-py3.10.egg\fire\core.py", line 67, in <module>
    from fire import formatting
  File "C:\Python310\lib\site-packages\fire-0.5.0-py3.10.egg\fire\formatting.py", line 22, in <module>
    import termcolor
ModuleNotFoundError: No module named 'termcolor'

Digging into the startup file, the following imports are not found:

import fire
from metagpt.software_company import SoftwareCompany
from metagpt.roles

Running Windows 11, using Powershell as a terminal. Ran through the steps exactly as stated. Tried deleting and re-cloning the repo. Tried running Powershell as admin.

请问如何配置使用Azure上的api?

你好,
我看到文档中需要配置openAI的key,但是我注意到在provider中有azure_api的相关文件,
请问是否在哪个地方可以配置让他使用azure提供的服务?

metagpt.config.NotConfiguredException: Set OPENAI_API_KEY first

Greetings!

I've tried several ways of passing the OPENAI_API_KEY

First, here is the Dockerfile:

Dockerfile
FROM bitnami/git:latest as clone

RUN git clone https://github.com/geekan/MetaGPT.git

FROM bitnami/node:latest

COPY --from=clone MetaGPT/ .

RUN python3 -m pip install --upgrade pip setuptools wheel

RUN npm install -g @mermaid-js/mermaid-cli &&\
    npm cache clean --force

RUN pip install -r requirements.txt &&\
    pip cache purge &&\
    python3 setup.py install

I tried with the equivalent of the docker run command in the instructions.

nerdctl run --rm -v /home/charlesrod/Documents/Projects/MetaGPT/config:/app/metagpt/config:rw -v /home/charlesrod/Documents/Projects/MetaGPT/workspace:/app/metagpt/workspace:rw docker.io/library/metagpt:latest

Oh, here is the config.yaml / key.yaml with the api key redacted

key.yaml
# 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
OPENAI_API_KEY: "sk-----"
#OPENAI_API_BASE: "YOUR_API_BASE"
OPENAI_API_MODEL: "gpt-4"
MAX_TOKENS: 1500
RPM: 10
#### 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
## 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"
#### for TTS
#AZURE_TTS_SUBSCRIPTION_KEY: "YOUR_API_KEY"
#AZURE_TTS_REGION: "eastus"

And when I check for the file, its there.

nerdctl run --rm -v /home/charlesrod/Documents/Projects/MetaGPT/config:/app/metagpt/config:rw -v /home/charlesrod/Documents/Projects/MetaGPT/workspace:/app/metagpt/workspace:rw docker.io/library/metagpt:latest cat metagpt/config/key.yaml
# 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

OPENAI_API_KEY: "sk-

Running without the volume mounts returns this:

nerdctl run --rm docker.io/library/metagpt:latest cat ./config/config.yaml
# 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

OPENAI_API_KEY: "YOUR_API_KEY"
#OPENAI_API_BASE: "YOUR_API_BASE"
OPENAI_API_MODEL: "gpt-4"
MAX_TOKENS: 1500
RPM: 10

but that's cause I cloned from source.

I also tried with passing the api key as an environment argument to the run command.

nerdctl run --rm -e OPENAI_API_KEY="sk-----" -v /home/charlesrod/Documents/Projects/MetaGPT/workspace:/app/metagpt/workspace docker.io/library/metagpt:latest python startup.py

I created a Kubernetes resource to run it. One where the config is mounted and another where the environment variables are part of the job spec ( latest attempt before raising this issue )

Job.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: meta-gpt-config
data:
  TASK_ARGUMENT: "Write a cli snake game"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: metagpt-pv-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi

---
apiVersion: batch/v1
kind: Job
metadata:
  name: metagpt-job
spec:
  template:
    spec:
      restartPolicy: Never
      volumes:
      - name: metagpt-pv-storage
        persistentVolumeClaim:
          claimName: metagpt-pv-claim
      containers:
      - name: gpt-agency
        image: metagpt:latest
        imagePullPolicy: Never
        volumeMounts:
        - mountPath: "/app/metagpt/workspace"
          name: metagpt-pv-storage
        command: ["/opt/bitnami/python/bin/python", "startup.py"]
        args: [ "$(TASK_ARGUMENT)" ]
        env:
          - name: TASK_ARGUMENT
            valueFrom:
              configMapKeyRef:
                name: meta-gpt-config
                key: TASK_ARGUMENT
          - name: OPENAI_API_KEY
            value: "sk-------"
          - name: OPENAI_API_MODEL
            value: "gpt-4"
          - name: MAX_TOKENS
            value: "1500"
          - name: RPM
            value: "10"
      - name: sidecar-container
        image: busybox
        volumeMounts:
        - mountPath: "/app/metagpt/workspace"
          name: metagpt-pv-storage
        command: ["sh", "-c", "while true; do sleep 3600; done"]

And the pod Errors with "metagpt.config.NotConfiguredException: Set OPENAI_API_KEY first".

Image

image

Updating the job to command: ["printenv"] again proves that teh env is there

2023-07-11T04:53:01.613165273Z HOSTNAME=metagpt-job-5z8hl
2023-07-11T04:53:01.613166605Z OS_ARCH=amd64
2023-07-11T04:53:01.613167610Z OS_FLAVOUR=debian-11
2023-07-11T04:53:01.613168404Z OS_NAME=linux
2023-07-11T04:53:01.613169287Z APP_VERSION=20.4.0
2023-07-11T04:53:01.613170462Z BITNAMI_APP_NAME=node
2023-07-11T04:53:01.613171725Z MAX_TOKENS=1500
2023-07-11T04:53:01.613172920Z RPM=10
2023-07-11T04:53:01.613174496Z TASK_ARGUMENT=Write a cli snake game
2023-07-11T04:53:01.613177938Z OPENAI_API_KEY=sk---------
2023-07-11T04:53:01.613179042Z OPENAI_API_MODEL=gpt-4

From the code in config.py https://github.com/geekan/MetaGPT/blob/317f0955ab81919e2ff32f0a81ad112131965123/metagpt/config.py#L64C73-L64C73

It looks like it should grab the environment variable as well. I rebuilt the image, since the git clone stage was cached from 2 days ago at this point.

I'm stumped at the moment.

RetryError[<Future at 0x7f806d336a60 state=finished raised ValidationError>]

(mgpt) dope@dope:~/Documents/metagpt$ python startup.py "Write a cli snake game"
2023-07-12 21:00:39.873 | INFO | metagpt.config:init:43 - Config loading done.
2023-07-12 21:00:39.873 | INFO | metagpt.config:init:49 - Set OPENAI_API_BASE in case of network issues
2023-07-12 21:00:40.585 | INFO | metagpt.software_company:invest:39 - Investment: $3.0.
2023-07-12 21:00:40.586 | INFO | metagpt.roles.role:_act:155 - Alice(Product Manager): ready to WritePRD
2023-07-12 21:00:40.586 | WARNING | metagpt.actions.search_and_summarize:run:114 - Configure SERPAPI_API_KEY to unlock full feature

Original Requirements:

The boss wants a command-line snake game.

Product Goals:

  • Create a fun and engaging snake game that can be played in the command-line interface.
  • Provide a challenging gameplay experience for users.
  • Implement intuitive controls and smooth animations for a seamless gaming experience.

User Stories:

  • As a user, I want to be able to control the snake using arrow keys.
  • As a user, I want the snake to grow longer each time it eats food.
  • As a user, I want the game to end if the snake collides with the wall or itself.
  • As a user, I want to see my score displayed on the screen.
  • As a user, I want the game to have different levels of difficulty.

Competitive Analysis:

  • Python Snake Game: A basic snake game implemented in Python with simple graphics.
  • Snake Xenzia: A popular snake game with improved graphics and additional features.
  • Snake VS Block: A modern twist on the classic snake game with obstacles and power-ups.
  • Slither.io: An online multiplayer snake game with a competitive leaderboard.
  • Snake '97: A nostalgic recreation of the classic snake game from the Nokia 3310.
  • Snake Rivals: A multiplayer snake game with real-time battles and customizable snakes.
  • Snake Zone: A 3D snake game with immersive graphics and challenging levels.

Competitive Quadrant Chart:

quadrantChart
    title Reach and engagement of snake games
    x-axis Low Reach --> High Reach
    y-axis Low Engagement --> High Engagement
    quadrant-1 Basic Games
    quadrant-2 Popular Games
    quadrant-3 Innovative Games
    quadrant-4 Advanced Games
    "Python Snake Game": [0.2, 0.3]
    "Snake Xenzia": [0.4, 0.4]
    "Snake VS Block": [0.6, 0.6]
    "Slither.io": [0.8, 0.7]
    "Snake '97": [0.3, 0.2]
    "Snake Rivals": [0.7, 0.8]
    "Snake Zone": [0.9, 0.9]
    "Our Target Product": [0.5, 0.6]

Requirement Analysis:

The product should be a command-line snake game with intuitive controls, smooth animations, and challenging gameplay. It should have different levels of difficulty and display the user's score on the screen. The game should end if the snake collides with the wall or itself.

Requirement Pool:

[
    ("Implement arrow key controls for the snake", "P0"),
    ("Implement snake growth when it eats food", "P0"),
    ("Detect collision with the wall or snake's body", "P0"),
    ("Display the user's score on the screen", "P1"),
    ("Implement different levels of difficulty", "P1")
]

Anything UNCLEAR:

There are no unclear points.
Warning: gpt-3.5-turbo may change over time. Returning num tokens assuming gpt-3.5-turbo-0301.
2023-07-12 21:00:55.796 | INFO | metagpt.provider.openai_api:update_cost:89 - Total running cost: $0.003 | Max budget: $3.000 | Current cost: $0.003, prompt_tokens=800, completion_tokens=625

Original Requirements:

The boss wants you to create a command-line snake game.

Product Goals:

  • Create a fun and engaging snake game.
  • Provide a smooth and responsive user experience.
  • Include customizable game settings for different difficulty levels.

User Stories:

  • As a user, I want to be able to control the snake using arrow keys.
  • As a user, I want the snake to grow longer when it eats food.
  • As a user, I want the game to end if the snake hits the wall or its own body.
  • As a user, I want to be able to pause and resume the game.
  • As a user, I want to see my current score and the highest score achieved.

Competitive Analysis:

  • Python Snake Game: A simple snake game implemented in Python with basic features.
  • Snake Xenzia: A classic snake game with improved graphics and sound effects.
  • Snake.io: A multiplayer snake game where players compete against each other.
  • Slither.io: A popular online multiplayer snake game with a large player base.
  • Snake '97: A nostalgic snake game that replicates the experience of playing on an old Nokia phone.
  • Snake Blast: A modern twist on the snake game with power-ups and special abilities.
  • Snake Rewind: A snake game with a rewind feature that allows players to undo their moves.

Competitive Quadrant Chart:

quadrantChart
    title Reach and engagement of snake games
    x-axis Low Reach --> High Reach
    y-axis Low Engagement --> High Engagement
    quadrant-1 We should expand
    quadrant-2 Need to promote
    quadrant-3 Re-evaluate
    quadrant-4 May be improved
    "Python Snake Game": [0.3, 0.6]
    "Snake Xenzia": [0.45, 0.23]
    "Snake.io": [0.57, 0.69]
    "Slither.io": [0.78, 0.34]
    "Snake '97": [0.40, 0.34]
    "Snake Blast": [0.35, 0.78]
    "Snake Rewind": [0.6, 0.7]
    "Our Target Product": [0.5, 0.6]

Requirement Analysis:

The product should be a command-line snake game with basic features such as controlling the snake, growing longer when eating food, and ending the game if the snake hits the wall or its own body. It should also include additional features like pausing and resuming the game, displaying the current score and highest score achieved, and customizable game settings for different difficulty levels.

Requirement Pool:

[
    ("End game when snake hits the wall or its own body", "P0"),
    ("Allow pausing and resuming the game", "P1"),
    ("Display current score and highest score achieved", "P1"),
    ("Customizable game settings for different difficulty levels", "P2")
]

Anything UNCLEAR:

There are no unclear points.
Warning: gpt-3.5-turbo may change over time. Returning num tokens assuming gpt-3.5-turbo-0301.
2023-07-12 21:01:11.573 | INFO | metagpt.provider.openai_api:update_cost:89 - Total running cost: $0.006 | Max budget: $3.000 | Current cost: $0.003, prompt_tokens=800, completion_tokens=636
Traceback (most recent call last):
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in call
result = await fn(*args, **kwargs)
File "/home/dope/Documents/metagpt/metagpt/actions/action.py", line 60, in _aask_v1
instruct_content = output_class(**parsed_data)
File "pydantic/main.py", line 331, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 3 validation errors for prd
Product Goals
value is not a valid list (type=type_error.list)
User Stories
value is not a valid list (type=type_error.list)
Competitive Analysis
value is not a valid list (type=type_error.list)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/dope/Documents/metagpt/startup.py", line 29, in
fire.Fire(main)
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/site-packages/fire-0.5.0-py3.9.egg/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/site-packages/fire-0.5.0-py3.9.egg/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/site-packages/fire-0.5.0-py3.9.egg/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/home/dope/Documents/metagpt/startup.py", line 25, in main
asyncio.run(startup(idea, investment, n_round))
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/home/dope/Documents/metagpt/startup.py", line 15, in startup
await company.run(n_round=n_round)
File "/home/dope/Documents/metagpt/metagpt/software_company.py", line 60, in run
await self.environment.run()
File "/home/dope/Documents/metagpt/metagpt/environment.py", line 64, in run
await asyncio.gather(*futures)
File "/home/dope/Documents/metagpt/metagpt/roles/role.py", line 229, in run
rsp = await self._react()
File "/home/dope/Documents/metagpt/metagpt/roles/role.py", line 200, in _react
return await self._act()
File "/home/dope/Documents/metagpt/metagpt/roles/role.py", line 156, in _act
response = await self._rc.todo.run(self._rc.important_memory)
File "/home/dope/Documents/metagpt/metagpt/actions/write_prd.py", line 138, in run
prd = await self._aask_v1(prompt, "prd", OUTPUT_MAPPING)
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
return await fn(*args, **kwargs)
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/site-packages/tenacity/_asyncio.py", line 47, in call
do = self.iter(retry_state=retry_state)
File "/home/dope/anaconda3/envs/mgpt/lib/python3.9/site-packages/tenacity/init.py", line 326, in iter
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7f806d336a60 state=finished raised ValidationError>]

关于自动生成的项目的完整性

我自己在本地测试了几次,生成的项目都不能直接执行,会有各种问题,比如写命令行贪吃蛇,curses库总是抛出错误:
File "/*****", line 28, in _draw_snake
self.screen.addch(position[0], position[1], "O")
_curses.error: add_wch() returned ERR
我注意到该仓库长期规划中会添加测试角色,所以我想问下当前自动生成的项目无法完整执行是否是正常情况😂谢谢!

代码长度问题。

目前普通来说的话,最大就是用3.5-16k的模型去写,但是很容易崩,因为16k还是不够执行下一轮,有没有可能之后改进到能吧前一轮的代码用embedded去压缩?不然gpt目前支持的长度太限制写出来的东西了。

Handling Rate Limit Reached

How do you handle rate limit issues? Hit this 3 times now.

Traceback (most recent call last):
File "/home/user/repos/mgptphp/startup.py", line 32, in
fire.Fire(main)
File "/home/user/.local/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/home/user/.local/lib/python3.10/site-packages/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/home/user/.local/lib/python3.10/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/home/user/repos/mgptphp/startupphp.py", line 28, in main
asyncio.run(startup(idea, investment, n_round))
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/user/repos/mgptphp/startupphp.py", line 15, in startup
await company.run(n_round=n_round)
File "/home/user/repos/mgptphp/metagpt/software_company.py", line 60, in run
await self.environment.run()
File "/home/user/repos/mgptphp/metagpt/environment.py", line 58, in run
await asyncio.gather(*futures)
File "/home/user/repos/mgptphp/metagpt/roles/role.py", line 223, in run
rsp = await self._react()
File "/home/user/repos/mgptphp/metagpt/roles/role.py", line 194, in _react
return await self._act()
File "/home/user/repos/mgptphp/metagpt/roles/engineer.py", line 139, in _act
return await self._act_sp()
File "/home/user/repos/mgptphp/metagpt/roles/engineer.py", line 124, in _act_sp
code_rsp = await WriteCode().run(
File "/home/user/repos/mgptphp/metagpt/actions/write_code.py", line 65, in run
code_rsp = await self._aask(prompt)
File "/home/user/repos/mgptphp/metagpt/actions/action.py", line 41, in _aask
return await self.llm.aask(prompt, system_msgs)
File "/home/user/repos/mgptphp/metagpt/provider/base_gpt_api.py", line 44, in aask
rsp = await self.acompletion_text(message, stream=True)
File "/home/user/repos/mgptphp/metagpt/provider/openai_api.py", line 27, in wrapper
return await f(*args, **kwargs)
File "/home/user/repos/mgptphp/metagpt/provider/openai_api.py", line 213, in acompletion_text
return await self._achat_completion_stream(messages)
File "/home/user/repos/mgptphp/metagpt/provider/openai_api.py", line 146, in _achat_completion_stream
response = await openai.ChatCompletion.acreate(
File "/home/user/.local/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 45, in acreate
return await super().acreate(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 217, in acreate
response, _, api_key = await requestor.arequest(
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 382, in arequest
resp, got_stream = await self._interpret_async_response(result, stream)
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 726, in _interpret_async_response
self._interpret_response_line(
File "/home/user/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 763, in _interpret_response_line
raise self.handle_error_response(
openai.error.RateLimitError: Rate limit reached for 10KTPM-200RPM in organization org-3Gxxxxxxxxxxxxxxxxxxxxx on tokens per min. Limit: 10000 / min. Please try again in 6ms. Contact us through our help center at help.openai.com if you continue to have issues.

My startup.py is a bit different since I am feeding it a txt file:
`#!/usr/bin/env python

-- coding: utf-8 --

import asyncio
import fire
from metagpt.software_company import SoftwareCompany
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer

async def startup(idea: list, investment: float = 3.0, n_round: int = 5):
"""Run a startup. Be a boss."""
company = SoftwareCompany()
company.hire([ProductManager(), Architect(), ProjectManager(), Engineer(n_borg=5)])
company.invest(investment)
company.start_project("\n".join(idea))
await company.run(n_round=n_round)

def main(idea_file: str, investment: float = 3.0, n_round: int = 5):
"""
We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities.
:param idea_file: Path to the file containing the innovative idea.
:param investment: As an investor, you have the opportunity to contribute a certain dollar amount to this AI company.
:return:
"""
with open(idea_file, 'r') as file:
idea = file.read().splitlines()

asyncio.run(startup(idea, investment, n_round))

if name == 'main':
fire.Fire(main)
`

Also I have changed all Python to PHP and PHP PSR-2 Compliant for now... as I am having it generate PHP code.

But, on this particular run I am hitting rate limit issues. Is there a way people are handling that?

Exception

Program call flow:

Title: Snake Game Call Flow

Player->Game: Start game
Game->Game: Initialize game
Game->Game: Start game loop
Player->Game: Control snake using arrow keys
Game->Game: Handle player input
Game->Snake: Change snake direction
Game->Snake: Move snake
Game->Snake: Check collision with boundaries
Game->Snake: Check collision with self
Game->Snake: Eat food if collided
Game->Game: Update game state
Game->Game: Draw game screen
Game->Game: Check game over condition
Game->Game: Pause game if requested
Player->Game: Resume game if paused
Game->Game: End game if game over
Player->Game: Restart game if desired

Anything UNCLEAR:

None.
Warning: gpt-3.5-turbo may change over time. Returning num tokens assuming gpt-3.5-turbo-0301.
2023-07-07 08:24:05.238 | INFO | metagpt.provider.openai_api:update_cost:90 - Total running cost: $0.006 | Max budget: $3.000 | Current cost: $0.004, prompt_tokens=1113, completion_tokens=692
2023-07-07 08:24:05.246 | ERROR | metagpt.utils.common:parse_code:67 - .*?\s+(.*?) not match following text:
2023-07-07 08:24:05.247 | ERROR | metagpt.utils.common:parse_code:68 - snake_game
Traceback (most recent call last):
File "/home/donp/Documents/coding/metagpt/startup.py", line 29, in
fire.Fire(main)
File "/usr/local/lib/python3.10/dist-packages/fire-0.5.0-py3.10.egg/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/usr/local/lib/python3.10/dist-packages/fire-0.5.0-py3.10.egg/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/usr/local/lib/python3.10/dist-packages/fire-0.5.0-py3.10.egg/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/home/donp/Documents/coding/metagpt/startup.py", line 25, in main
asyncio.run(startup(idea, investment, n_round))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/home/donp/Documents/coding/metagpt/startup.py", line 15, in startup
await company.run(n_round=n_round)
File "/home/donp/Documents/coding/metagpt/metagpt/software_company.py", line 55, in run
await self.environment.run()
File "/home/donp/Documents/coding/metagpt/metagpt/environment.py", line 58, in run
await asyncio.gather(*futures)
File "/home/donp/Documents/coding/metagpt/metagpt/roles/role.py", line 223, in run
rsp = await self._react()
File "/home/donp/Documents/coding/metagpt/metagpt/roles/role.py", line 194, in _react
return await self._act()
File "/home/donp/Documents/coding/metagpt/metagpt/roles/role.py", line 154, in _act
response = await self._rc.todo.run(self._rc.important_memory)
File "/home/donp/Documents/coding/metagpt/metagpt/actions/design_api.py", line 86, in run
self._save(context, system_design)
File "/home/donp/Documents/coding/metagpt/metagpt/actions/design_api.py", line 73, in _save
ws_name = CodeParser.parse_str(block="Python package name", text=system_design)
File "/home/donp/Documents/coding/metagpt/metagpt/utils/common.py", line 74, in parse_str
code = cls.parse_code(block, text, lang)
File "/home/donp/Documents/coding/metagpt/metagpt/utils/common.py", line 69, in parse_code
raise Exception
Exception

parse_code报错

The specific requirements for fine-tuning algorithms for the Hua project are not clear.
2023-07-06 16:20:38.774 | INFO | metagpt.provider.openai_api:update_cost:91 - Total running cost: $0.007 | Max budget: $3.000 | Current cost: $0.004, prompt_tokens=1235, completion_tokens=561
2023-07-06 16:20:38.777 | ERROR | metagpt.utils.common:parse_code:66 - .*?\s+(.*?) not match following text:
2023-07-06 16:20:38.778 | ERROR | metagpt.utils.common:parse_code:67 - training_platform
Traceback (most recent call last):
File "D:\Code\MetaGPT\startup.py", line 29, in
fire.Fire(main)
File "D:\Anaconda\envs\metagpt\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "D:\Anaconda\envs\metagpt\lib\site-packages\fire\core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "D:\Anaconda\envs\metagpt\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "D:\Code\MetaGPT\startup.py", line 25, in main
asyncio.run(startup(idea, investment))
raise Exception
Exception
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000021B94788E50>
Traceback (most recent call last):
File "D:\Anaconda\envs\metagpt\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "D:\Anaconda\envs\metagpt\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "D:\Anaconda\envs\metagpt\lib\asyncio\base_events.py", line 751, in call_soon
self._check_closed()
File "D:\Anaconda\envs\metagpt\lib\asyncio\base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

如何细化需求?

只用一句话去创建整个项目从商业设计上来讲是不靠谱的除非是很简单的逻辑比如“创建一个js版本的贪食蛇”。但是当我们要依赖AI去设计更大规模的系统时,我建议还是需要增加更加复杂的交互式设计通过AI去收集多轮对话的需求以及更多的细节让整个项目的生成变得更加可靠。如果是真的考虑商业化落地的话

error: Setup script exited with error: command '/usr/bin/clang' failed with exit code 1

parsed = self.parsers.get(option_name, lambda x: x)(value)
warning: no files found matching 'aiohttp' anywhere in distribution
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '
.pyd' found anywhere in distribution
warning: no previously-included files matching '.so' found anywhere in distribution
warning: no previously-included files matching '
.lib' found anywhere in distribution
warning: no previously-included files matching '.dll' found anywhere in distribution
warning: no previously-included files matching '
.a' found anywhere in distribution
warning: no previously-included files matching '.obj' found anywhere in distribution
warning: no previously-included files found matching 'aiohttp/
.html'
no previously-included directories found matching 'docs/_build'
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

    ********************************************************************************
    Please avoid running ``setup.py`` directly.
    Instead, use pypa/build, pypa/installer or other
    standards-based tools.

    See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
    ********************************************************************************

!!
self.initialize_options()
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: Setup script exited with error: command '/usr/bin/clang' failed with exit code 1

pip install .

installing via readme

python setup.py install

output

running install
/home/pi/.local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/pi/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/lib/python3.9/site-packages'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/lib/python3.9/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).

求助,第一次用。JSONDecodeError("Expecting value", s, err.value) from None

Traceback (most recent call last):
File "D:\Documents\Python\MetaGPT-main\lib\site-packages\openai\api_requestor.py", line 753, in interpret_response_line
data = json.loads(rbody)
File "C:\Users\CV\AppData\Local\Programs\Python\Python39\lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\CV\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\CV\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

感谢项目组!

convert all the chinese to english

If you want to do overseas market, its better that all the codes including the docstrings are done in English.
I am also doing coding agent. CodingAgent has quicker and better market share overseas

Other Programming Languages

Right now, python language is hard coded. It would be nice if, it took the language from the initial prompt, or took the programming language as a command line argument.

python setup.py install

当我按使用python setup.py install命令时
控制台最后几行显示如下并结束

Processing metagpt-0.1-py3.11.egg
Removing d:\worktools\python3.11.4\lib\site-packages\metagpt-0.1-py3.11.egg
error: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'd:\\worktools\\python3.11.4\\lib\\site-packages\\metagpt-0.1-py3.11.egg'

于是我直接启动python startup.py "写一个命令行贪吃蛇"
控制台返回如下并结束

Traceback (most recent call last):
  File "D:\workSpace\metagpt\startup.py", line 5, in <module>
    import fire
ModuleNotFoundError: No module named 'fire'

any idea what I am doing wrong here ?

python startup.py "Write a cli lightning game game which teaches you how lightning works with interactive gameplay"
2023-07-07 19:32:24.269 | INFO | metagpt.config:init:43 - Config loading done.
Traceback (most recent call last):
File "C:\Windows\System32\metagpt\startup.py", line 5, in
from metagpt.software_company import SoftwareCompany
File "C:\Windows\System32\metagpt\metagpt\software_company.py", line 10, in
from metagpt.config import CONFIG
File "C:\Windows\System32\metagpt\metagpt\config.py", line 91, in
CONFIG = Config()
File "C:\Windows\System32\metagpt\metagpt\utils\singleton.py", line 21, in call
cls._instances[cls] = super(Singleton, cls).call(*args, **kwargs)
File "C:\Windows\System32\metagpt\metagpt\config.py", line 46, in init
raise NotConfiguredException("Set OPENAI_API_KEY first")
metagpt.config.NotConfiguredException: Set OPENAI_API_KEY first

have set https_proxy http_proxy but still meet a except "Error communicating with OpenAI"

I have set https_proxy http_proxy but still meet a except "Error communicating with OpenAI" . I find It can work when using openai.Completion.create. So why it cause exception when using await openai.ChatCompletion.acreate ? thanks

script:
jjxx@SH-jjxx-1 MetaGPT % /Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/bin/python startup.py "Write a cli snake game"

logs:
2023-07-15 17:37:57.233 | INFO | metagpt.config:init:43 - Config loading done.
2023-07-15 17:37:57.233 | INFO | metagpt.config:init:49 - Set OPENAI_API_BASE in case of network issues
2023-07-15 17:37:58.835 | INFO | metagpt.software_company:invest:39 - Investment: $3.0.
2023-07-15 17:37:58.836 | INFO | metagpt.roles.role:_act:153 - Alice(Product Manager): ready to WritePRD
2023-07-15 17:37:58.836 | WARNING | metagpt.actions.search_and_summarize:run:114 - Configure SERPAPI_API_KEY to unlock full feature
Traceback (most recent call last):
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/asyncio/base_events.py", line 1080, in create_connection
transport, protocol = await self._create_connection_transport(
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/asyncio/base_events.py", line 1110, in _create_connection_transport
await waiter
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/asyncio/selector_events.py", line 856, in _read_ready__data_received
data = self._sock.recv(self.max_size)
ConnectionResetError: [Errno 54] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/openai/api_requestor.py", line 668, in arequest_raw
result = await session.request(**request_kwargs)
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request
conn = await self._connector.connect(
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
raise last_exc
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.openai.com:443 ssl:default [Connection reset by peer]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/startup.py", line 29, in
fire.Fire(main)
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/startup.py", line 25, in main
asyncio.run(startup(idea, investment, n_round))
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/startup.py", line 15, in startup
await company.run(n_round=n_round)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/software_company.py", line 60, in run
await self.environment.run()
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/environment.py", line 58, in run
await asyncio.gather(*futures)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/roles/role.py", line 223, in run
rsp = await self._react()
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/roles/role.py", line 194, in _react
return await self._act()
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/roles/role.py", line 154, in _act
response = await self._rc.todo.run(self._rc.important_memory)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/actions/write_prd.py", line 76, in run
prd = await self._aask(prompt)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/actions/action.py", line 41, in _aask
return await self.llm.aask(prompt, system_msgs)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/provider/base_gpt_api.py", line 44, in aask
rsp = await self.acompletion_text(message, stream=True)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/provider/openai_api.py", line 27, in wrapper
return await f(*args, **kwargs)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/provider/openai_api.py", line 213, in acompletion_text
return await self._achat_completion_stream(messages)
File "/Users/jjxx/wwwxx/workspace/mltasks/llmapp-ws/MetaGPT/metagpt/provider/openai_api.py", line 146, in _achat_completion_stream
response = await openai.ChatCompletion.acreate(
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 45, in acreate
return await super().acreate(*args, **kwargs)
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 217, in acreate
response, _, api_key = await requestor.arequest(
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/openai/api_requestor.py", line 372, in arequest
result = await self.arequest_raw(
File "/Users/jjxx/wwwxx/software/miniconda3/envs/py3.10/lib/python3.10/site-packages/openai/api_requestor.py", line 685, in arequest_raw
raise error.APIConnectionError("Error communicating with OpenAI") from e
openai.error.APIConnectionError: Error communicating with OpenAI

task not completed and issues during the process

Hi,
at the very beginning I would like to say, that the project idea is amazing and I like it pretty much. Congratulations.

I installed it on my docker desktop and I was able to run it, however I encountered some errors.

Here is my initial prompt:
python startup.py "create a snake game that will be in a separate window and then snake will be in orange colour. When snake hits the wall the game is over."

And it was working properly until this step:
image

for almost all files except mmd files in resources:
image

and also md files for docs:
image

After this part it did this:
image

And then I got this error:
image

so overall, no game was created, only the files that you see in docs and resources directories.

Can you please tell me how to solve these issues and test this solution to the fullest?

Thanks a lot!

生成代码经常在文件头引用有问题

生成代码经常在文件头引用有两个问题:

  1. from wrong_packagename.CLASSNAME import xxxx
  2. 自身生成class引用经常出问题,没有声明引用 from xxxx import Xxxx

TypeError: issubclass() arg 1 must be a class

(base) dope@dope:~/Documents/metagpt$ python startup.py "Write a cli snake game"
2023-07-12 19:22:49.402 | INFO | metagpt.config:init:43 - Config loading done.
2023-07-12 19:22:49.402 | INFO | metagpt.config:init:49 - Set OPENAI_API_BASE in case of network issues
Traceback (most recent call last):
File "/home/dope/Documents/metagpt/startup.py", line 5, in
from metagpt.software_company import SoftwareCompany
File "/home/dope/Documents/metagpt/metagpt/software_company.py", line 11, in
from metagpt.actions import BossRequirement
File "/home/dope/Documents/metagpt/metagpt/actions/init.py", line 10, in
from metagpt.actions.action import Action
File "/home/dope/Documents/metagpt/metagpt/actions/action.py", line 15, in
from metagpt.utils.common import OutputParser
File "/home/dope/Documents/metagpt/metagpt/utils/common.py", line 15, in
from langchain.schema import AgentAction, AgentFinish, OutputParserException
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/init.py", line 6, in
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/agents/init.py", line 2, in
from langchain.agents.agent import (
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/agents/agent.py", line 16, in
from langchain.agents.tools import InvalidTool
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/agents/tools.py", line 8, in
from langchain.tools.base import BaseTool, Tool, tool
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/tools/init.py", line 3, in
from langchain.tools.arxiv.tool import ArxivQueryRun
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/tools/arxiv/tool.py", line 12, in
from langchain.utilities.arxiv import ArxivAPIWrapper
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/utilities/init.py", line 3, in
from langchain.utilities.apify import ApifyWrapper
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/utilities/apify.py", line 5, in
from langchain.document_loaders import ApifyDatasetLoader
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/document_loaders/init.py", line 44, in
from langchain.document_loaders.embaas import EmbaasBlobLoader, EmbaasLoader
File "/home/dope/anaconda3/lib/python3.10/site-packages/langchain-0.0.230-py3.10.egg/langchain/document_loaders/embaas.py", line 54, in
class BaseEmbaasLoader(BaseModel):
File "pydantic/main.py", line 204, in pydantic.main.ModelMetaclass.new
File "pydantic/fields.py", line 488, in pydantic.fields.ModelField.infer
File "pydantic/fields.py", line 419, in pydantic.fields.ModelField.init
File "pydantic/fields.py", line 539, in pydantic.fields.ModelField.prepare
File "pydantic/fields.py", line 801, in pydantic.fields.ModelField.populate_validators
File "pydantic/validators.py", line 696, in find_validators
File "pydantic/validators.py", line 585, in pydantic.validators.make_typeddict_validator
File "pydantic/annotated_types.py", line 35, in pydantic.annotated_types.create_model_from_typeddict
File "pydantic/main.py", line 972, in pydantic.main.create_model
File "pydantic/main.py", line 204, in pydantic.main.ModelMetaclass.new
File "pydantic/fields.py", line 488, in pydantic.fields.ModelField.infer
File "pydantic/fields.py", line 419, in pydantic.fields.ModelField.init
File "pydantic/fields.py", line 534, in pydantic.fields.ModelField.prepare
File "pydantic/fields.py", line 638, in pydantic.fields.ModelField._type_analysis
File "/home/dope/anaconda3/lib/python3.10/typing.py", line 1158, in subclasscheck
return issubclass(cls, self.origin)
TypeError: issubclass() arg 1 must be a class

No module named 'win32_setctime'

win 10 执行 python startup.py "写一个俄罗斯方块"
报错信息如下:
Traceback (most recent call last):
File "E:\code\mategpt\metagpt\startup.py", line 5, in
from metagpt.software_company import SoftwareCompany
File "E:\code\mategpt\metagpt\metagpt\software_company.py", line 9, in
from metagpt.config import Config
File "E:\code\mategpt\metagpt\metagpt\config.py", line 10, in
from metagpt.logs import logger
File "E:\code\mategpt\metagpt\metagpt\logs.py", line 10, in
from loguru import logger as logger
File "E:\Programs\Python\Python310\lib\site-packages\loguru-0.7.0-py3.10.egg\loguru_init
.py", line 10, in
from ._logger import Core as _Core
File "E:\Programs\Python\Python310\lib\site-packages\loguru-0.7.0-py3.10.egg\loguru_logger.py", line 95, in
from ._file_sink import FileSink
File "E:\Programs\Python\Python310\lib\site-packages\loguru-0.7.0-py3.10.egg\loguru_file_sink.py", line 12, in
from ._ctime_functions import get_ctime, set_ctime
File "E:\Programs\Python\Python310\lib\site-packages\loguru-0.7.0-py3.10.egg\loguru_ctime_functions.py", line 57, in
get_ctime, set_ctime = load_ctime_functions()
File "E:\Programs\Python\Python310\lib\site-packages\loguru-0.7.0-py3.10.egg\loguru_ctime_functions.py", line 6, in load_ctime_functions
import win32_setctime
ModuleNotFoundError: No module named 'win32_setctime'

windows运行报错

PS D:\MetaGPT\metagpt> python startup.py "写一个命令行贪吃蛇"
2023-07-04 13:05:13.298 | INFO | metagpt.config:init:43 - Config loading done.
2023-07-04 13:05:13.299 | INFO | metagpt.config:init:49 - Set OPENAI_API_BASE in case of network issues
Traceback (most recent call last):
File "D:\MetaGPT\metagpt\startup.py", line 5, in
from metagpt.software_company import SoftwareCompany
File "D:\MetaGPT\metagpt\metagpt\software_company.py", line 13, in
from metagpt.actions import BossRequirement
File "D:\MetaGPT\metagpt\metagpt\actions_init_.py", line 14, in
from metagpt.actions.design_api import WriteDesign
File "D:\MetaGPT\metagpt\metagpt\actions\design_api.py", line 15, in
from metagpt.utils.common import mermaid_to_file
ImportError: cannot import name 'mermaid_to_file' from 'metagpt.utils.common' (D:\MetaGPT\metagpt\metagpt\utils\common.py)
PS D:\MetaGPT\metagpt>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.