MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

ERROR | metagpt.utils.common:log_it:554

Open nickbrigham opened this issue 9 months ago • 7 comments

Bug description I get the following error message when trying to run metagpt

2024-05-14 14:40:02.842 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 234.119(s), this was the 6th time calling it. exp: openai.types.completion_usage.CompletionUsage() argument after ** must be a mapping, not NoneType 2024-05-14 14:40:02.843 | WARNING | metagpt.utils.common:wrapper:649 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory. 2024-05-14 14:40:02.867 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/actions/action_node.py", line 420, in _aask_v1 content = await self.llm.aask(prompt, system_msgs, images=images, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: openai.types.completion_usage.CompletionUsage() argument after ** must be a mapping, not NoneType

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

Traceback (most recent call last): File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/utils/common.py", line 640, in wrapper return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/roles/role.py", line 555, in run rsp = await self.react() ^^^^^^^^^^^^^^^^^^ tenacity.RetryError: RetryError[<Future at 0x134cd6a10 state=finished raised TypeError>]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/utils/common.py", line 626, in wrapper result = await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/team.py", line 131, in run await self.env.run() Exception: Traceback (most recent call last): File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/actions/action_node.py", line 420, in _aask_v1 content = await self.llm.aask(prompt, system_msgs, images=images, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/provider/base_llm.py", line 150, in aask rsp = await self.acompletion_text(message, stream=stream, timeout=self.get_timeout(timeout)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/init.py", line 314, in iter return fut.result() ^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/provider/openai_api.py", line 155, in acompletion_text return await self._achat_completion_stream(messages, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/provider/openai_api.py", line 105, in _achat_completion_stream usage = CompletionUsage(**chunk.usage) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: openai.types.completion_usage.CompletionUsage() argument after ** must be a mapping, not NoneType

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

Traceback (most recent call last): File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/utils/common.py", line 640, in wrapper return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/roles/role.py", line 555, in run rsp = await self.react() ^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/roles/role.py", line 522, in react rsp = await self._react() ^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/roles/role.py", line 468, in _react rsp = await self._act() ^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/roles/role.py", line 397, in _act response = await self.rc.todo.run(self.rc.history) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/actions/write_prd.py", line 87, in run return await self._handle_new_requirement(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/actions/write_prd.py", line 108, in _handle_new_requirement node = await WRITE_PRD_NODE.fill(context=context, llm=self.llm, exclude=exclude) # schema=schema ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/actions/action_node.py", line 504, in fill return await self.simple_fill(schema=schema, mode=mode, images=images, timeout=timeout, exclude=exclude) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/metagpt-0.8.1-py3.11.egg/metagpt/actions/action_node.py", line 456, in simple_fill content, scontent = await self._aask_v1( ^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Nick/anaconda3/envs/metagpt/lib/python3.11/site-packages/tenacity/init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x134cd6a10 state=finished raised TypeError>]

Don't close this pointing me to #1253. I tried that and it didn't fix the issue, garylin2099.

  • LLM type and model name: openai gpt 4
  • System version: macOS Monterey
  • Python version: 3.11.5
  • MetaGPT version or branch: newest
  • installation method: pip install

Any help would be greatly appreciated.

nickbrigham avatar May 14 '24 18:05 nickbrigham

Hi, can you try the main branch or pip install git+https://github.com/geekan/MetaGPT first? We will fix the v0.8 version soon.

garylin2099 avatar May 15 '24 03:05 garylin2099

@garylin2099 main branch is working fine after yesterday's fix , thanks

ame700 avatar May 15 '24 08:05 ame700

Hi, can you try the main branch or pip install git+https://github.com/geekan/MetaGPT first? We will fix the v0.8 version soon.

I tried that and it didn't work either. Pretty frustrating. @garylin2099

nickbrigham avatar May 15 '24 19:05 nickbrigham

@garylin2099 I get this error message when I try to install. Does this have something to do with my issue?

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. instructor 1.2.2 requires aiohttp<4.0.0,>=3.9.1, but you have aiohttp 3.8.6 which is incompatible. instructor 1.2.2 requires pydantic==2.7.0, but you have pydantic 2.6.4 which is incompatible. instructor 1.2.2 requires pydantic-core<3.0.0,>=2.18.0, but you have pydantic-core 2.16.3 which is incompatible. instructor 1.2.2 requires rich<14.0.0,>=13.7.0, but you have rich 13.6.0 which is incompatible. fastapi-cli 0.0.3 requires typer>=0.12.3, but you have typer 0.9.0 which is incompatible. agency-swarm 0.2.1 requires openai==1.23.3, but you have openai 1.6.1 which is incompatible. agency-swarm 0.2.1 requires rich==13.7.0, but you have rich 13.6.0 which is incompatible. gradio 4.29.0 requires typer<1.0,>=0.12; sys_platform != "emscripten", but you have typer 0.9.0 which is incompatible. gradio 4.29.0 requires urllib3~=2.0, but you have urllib3 1.26.18 which is incompatible. anaconda-cloud-auth 0.1.4 requires pydantic<2.0, but you have pydantic 2.6.4 which is incompatible. anaconda-cloud-auth 0.1.4 requires semver<3, but you have semver 3.0.2 which is incompatible. Successfully installed aiohttp-3.8.6 metagpt-0.8.1 openai-1.6.1 pydantic-2.6.4 pydantic-core-2.16.3 rich-13.6.0 typer-0.9.0 urllib3-1.26.18

nickbrigham avatar May 15 '24 19:05 nickbrigham

now, when I run python startup.py "input here", it does nothing.

nickbrigham avatar May 16 '24 08:05 nickbrigham

Could you please pull the latest code and try again? @nickbrigham

geekan avatar May 18 '24 09:05 geekan

image 解决了没有这个问题,我这里也出现了

luozeyu1015 avatar Jun 06 '24 09:06 luozeyu1015

Due to the lack of updates or replies by the user for a long time, we will close it. Please reopen it if necessary.

garylin2099 avatar Oct 11 '24 12:10 garylin2099