Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tenacity.RetryError #1475

Closed
wzpchris opened this issue Sep 9, 2024 · 2 comments
Closed

tenacity.RetryError #1475

wzpchris opened this issue Sep 9, 2024 · 2 comments

Comments

@wzpchris
Copy link

wzpchris commented Sep 9, 2024

Bug description
2024-09-09 17:51:05.664 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 59.765(s), this was the 6th time calling it. exp: openai.types.completion_usage.CompletionUsage() argument after ** must be a mapping, not NoneType
2024-09-09 17:51:05.666 | 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-09-09 17:51:05.683 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp:
Traceback (most recent call last):
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_asyncio.py", line 50, in call
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\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 "D:\soft\Python\Python311\Lib\site-packages\metagpt\utils\common.py", line 640, in wrapper
return await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\roles\role.py", line 550, in run
rsp = await self.react()
^^^^^^^^^^^^^^^^^^
tenacity.RetryError: RetryError[<Future at 0x24879fb2ed0 state=finished raised TypeError>]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\utils\common.py", line 626, in wrapper
result = await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\team.py", line 134, in run
await self.env.run()
Exception: Traceback (most recent call last):
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_asyncio.py", line 50, in call
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\actions\action_node.py", line 420, in aask_v1
content = await self.llm.aask(prompt, system_msgs, images=images, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\provider\base_llm.py", line 150, in aask
rsp = await self.acompletion_text(message, stream=stream, timeout=self.get_timeout(timeout))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_asyncio.py", line 47, in call
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_init
.py", line 314, in iter
return fut.result()
^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\concurrent\futures_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\concurrent\futures_base.py", line 401, in __get_result
raise self._exception
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_asyncio.py", line 50, in call
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\provider\openai_api.py", line 141, in acompletion_text
return await self._achat_completion_stream(messages, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\provider\openai_api.py", line 94, 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 "D:\soft\Python\Python311\Lib\site-packages\metagpt\utils\common.py", line 640, in wrapper
return await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\roles\role.py", line 550, in run
rsp = await self.react()
^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\roles\role.py", line 517, in react
rsp = await self._react()
^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\roles\role.py", line 463, in _react
rsp = await self._act()
^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\roles\role.py", line 392, in _act
response = await self.rc.todo.run(self.rc.history)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\actions\write_prd.py", line 87, in run
return await self._handle_new_requirement(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\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 "D:\soft\Python\Python311\Lib\site-packages\metagpt\actions\action_node.py", line 505, in fill
return await self.simple_fill(schema=schema, mode=mode, images=images, timeout=timeout, exclude=exclude)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\metagpt\actions\action_node.py", line 457, in simple_fill
content, scontent = await self.aask_v1(
^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_asyncio.py", line 47, in call
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\soft\Python\Python311\Lib\site-packages\tenacity_init
.py", line 326, in iter
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x24879fb2ed0 state=finished raised TypeError>]

Environment information

  • LLM type and model name: openai -- gpt-4o
  • System version: windows
  • Python version: 3.11.9
  • MetaGPT version or branch: 0.8.1

image

image

@seehi
Copy link
Contributor

seehi commented Sep 9, 2024

I can run your code normally. Make sure the LLM configuration is correct: https://docs.deepwisdom.ai/main/en/guide/get_started/configuration/llm_api_configuration.html

@better629
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants