MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

tenacity.RetryError: RetryError[<Future at 0x7f3a022638b0 state=finished raised ValidationError>]

Open Clemtobas opened this issue 2 years ago • 4 comments
trafficstars

Command executed: python startup.py "my_prompt"

Setup: python3.9.5, node v20.5.0, npm v 9.8.0, Ubuntu 20.04

OpenAI models tried: GPT3.5-turbo and GPT3.5-turbo-16k

Result expected: The code finishes with the code generated according to the prompt

Result obtained: The code stops because of an error -> tenacity.RetryError: RetryError[<Future at 0x7f3a022638b0 state=finished raised ValidationError>].

Tried to run the code multiple times, always the same result.

Error traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/tenacity-8.2.2-py3.9.egg/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
  File "/home/user/Documents/metagpt/metagpt/actions/action.py", line 62, in _aask_v1
    instruct_content = output_class(**parsed_data)
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 5 validation errors for prd
Requirement Pool -> 0
  value is not a valid tuple (type=type_error.tuple)
Requirement Pool -> 1
  value is not a valid tuple (type=type_error.tuple)
Requirement Pool -> 2
  value is not a valid tuple (type=type_error.tuple)
Requirement Pool -> 3
  value is not a valid tuple (type=type_error.tuple)
Requirement Pool -> 4
  value is not a valid tuple (type=type_error.tuple)

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

Traceback (most recent call last):
  File "/home/user/Documents/metagpt/startup.py", line 42, in <module>
    fire.Fire(main)
  File "/usr/local/lib/python3.9/dist-packages/fire-0.4.0-py3.9.egg/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.9/dist-packages/fire-0.4.0-py3.9.egg/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/usr/local/lib/python3.9/dist-packages/fire-0.4.0-py3.9.egg/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/user/Documents/metagpt/startup.py", line 38, in main
    asyncio.run(startup(idea, investment, n_round, code_review, run_tests))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/user/Documents/metagpt/startup.py", line 26, in startup
    await company.run(n_round=n_round)
  File "/home/user/Documents/metagpt/metagpt/software_company.py", line 60, in run
    await self.environment.run()
  File "/home/user/Documents/metagpt/metagpt/environment.py", line 67, in run
    await asyncio.gather(*futures)
  File "/home/user/Documents/metagpt/metagpt/roles/role.py", line 240, in run
    rsp = await self._react()
  File "/home/user/Documents/metagpt/metagpt/roles/role.py", line 209, in _react
    return await self._act()
  File "/home/user/Documents/metagpt/metagpt/roles/role.py", line 168, in _act
    response = await self._rc.todo.run(self._rc.important_memory)
  File "/home/user/Documents/metagpt/metagpt/actions/write_prd.py", line 145, in run
    prd = await self._aask_v1(prompt, "prd", OUTPUT_MAPPING)
  File "/usr/local/lib/python3.9/dist-packages/tenacity-8.2.2-py3.9.egg/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/tenacity-8.2.2-py3.9.egg/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
  File "/usr/local/lib/python3.9/dist-packages/tenacity-8.2.2-py3.9.egg/tenacity/__init__.py", line 326, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7f3a022638b0 state=finished raised ValidationError>]

Question: Is this behaviour due to a bug in the code or can I do something to solve it on my side?

Clemtobas avatar Aug 09 '23 18:08 Clemtobas

I ended up having the same issue, and was resolved by install mermaid-js as described in the README file.

frankkloster avatar Aug 09 '23 21:08 frankkloster

Refer to #176 please.

voidking avatar Aug 10 '23 09:08 voidking

I ran into the same error. Installing mermaid-js as described in the README file does not help

RocketStar avatar Aug 26 '23 23:08 RocketStar

This problem actually comes from the poor Instruction Following of gpt-3.5-turbo. gpt-4 basically does not have this problem

geekan avatar Sep 09 '23 03:09 geekan