遇到个bug tenacity.RetryError: RetryError[<Future at 0x7f0b05a80c40 state=finished raised RetryError>]
Bug description Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 382, in call result = fn(*args, **kwargs) File "/app/metagpt/metagpt/utils/repair_llm_raw_output.py", line 296, in retry_parse_json_text parsed_data = CustomDecoder(strict=False).decode(output) json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "/app/metagpt/metagpt/actions/action_node.py", line 442, in _aask_v1 parsed_data = llm_output_postprocess( tenacity.RetryError: RetryError[<Future at 0x7f0b05a80cd0 state=finished raised JSONDecodeError>]
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/app/metagpt/metagpt/utils/common.py", line 664, in wrapper return await func(self, *args, **kwargs) File "/app/metagpt/metagpt/roles/role.py", line 551, in run rsp = await self.react() tenacity.RetryError: RetryError[<Future at 0x7f0b05a80c40 state=finished raised RetryError>]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/app/metagpt/metagpt/utils/common.py", line 650, in wrapper result = await func(self, *args, **kwargs) File "/app/metagpt/metagpt/team.py", line 134, in run await self.env.run() Exception: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 382, in call result = fn(*args, **kwargs) File "/app/metagpt/metagpt/utils/repair_llm_raw_output.py", line 296, in retry_parse_json_text parsed_data = CustomDecoder(strict=False).decode(output) File "/app/metagpt/metagpt/utils/custom_decoder.py", line 297, in decode return super().decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.9/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)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "/app/metagpt/metagpt/actions/action_node.py", line 442, in _aask_v1 parsed_data = llm_output_postprocess( File "/app/metagpt/metagpt/provider/postprocess/llm_output_postprocess.py", line 19, in llm_output_postprocess result = postprocess_plugin.run(output=output, schema=schema, req_key=req_key) File "/app/metagpt/metagpt/provider/postprocess/base_postprocess_plugin.py", line 68, in run new_output = self.run_repair_llm_output(output=output, schema=schema, req_key=req_key) File "/app/metagpt/metagpt/provider/postprocess/base_postprocess_plugin.py", line 32, in run_repair_llm_output parsed_data = self.run_retry_parse_json_text(content) File "/app/metagpt/metagpt/provider/postprocess/base_postprocess_plugin.py", line 47, in run_retry_parse_json_text parsed_data = retry_parse_json_text(output=content) # should use output=content File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 289, in wrapped_f return self(f, *args, **kw) File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 379, in call do = self.iter(retry_state=retry_state) File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x7f0b05a80cd0 state=finished raised JSONDecodeError>]
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/app/metagpt/metagpt/utils/common.py", line 664, in wrapper return await func(self, *args, **kwargs) File "/app/metagpt/metagpt/roles/role.py", line 551, in run rsp = await self.react() File "/app/metagpt/metagpt/roles/role.py", line 520, in react rsp = await self._react() File "/app/metagpt/metagpt/roles/role.py", line 475, in _react rsp = await self._act() File "/app/metagpt/metagpt/roles/role.py", line 404, in _act response = await self.rc.todo.run(self.rc.history) File "/app/metagpt/metagpt/actions/write_prd.py", line 87, in run return await self._handle_new_requirement(req) File "/app/metagpt/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 "/app/metagpt/metagpt/actions/action_node.py", line 648, in fill return await self.simple_fill(schema=schema, mode=mode, images=images, timeout=timeout, exclude=exclude) File "/app/metagpt/metagpt/actions/action_node.py", line 473, in simple_fill content, scontent = await self._aask_v1( File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x7f0b05a80c40 state=finished raised RetryError>]
Environment information lmstudio 部署的 qwen1.5-0.5b-chat。 在你们提供的docker容器运行。
能够输出code代码。不知道什么原因造成的。
random from random import randint
class Game: def init(self): self.score = 0 self difficulty = 1 self.user_stories = []
def play(self, player_id):
# Generate random number between 0 and 2047
player_number = randint(0, 2048)
# Get user's score
self.score += player_number
# Get user's name
self.user_stories.append(f"Player {player_number}: {self.score}")
def restart(self):
# Get user's current score
self.score = random.randint(0, 2047)
# Get user's best score
self.best_score = float("inf")
def get_best_score(self):
# Get user's best score
return self.best_score
def get_restart_button(self):
# Get user's restart button
return self.restart_button
Create a simple game with 2048 players and a leaderboard
game = Game() player1 = random.randint(0, 2047) player2 = random.randint(0, 2047) player3 = random.randint(0, 2047) player4 = random.randint(0, 2047) player5 = random.randint(0, 2047)
Play the game
game.play(player1) game.play(player2) game.play(player3) game.play(player4) game.play(player5)
Get user's best score and restart button
best_score = game.get_best_score() best_button = game.get_restart_button()
Get user's current score
current_score = random.randint(0, 2047)
Get user's best score
best_score = game.get_best_score() best_button = game.get_restart_button()
Get user's restart button
best_button = game.get_restart_button()
print("Player 1: {player1}, Player 2: {player2}, Player 3: {player3}, Player 4: {player4}, Player 5: {player5}") print("Best score: {best_score}") print("Restart button: {best_button}")
This code creates a simple game with 2048 players and a leaderboard. The player's scores are displayed on the screen, and the best score is displayed at the top of the leaderboard. The restart button is also displayed at the top of the leaderboard.
```python
# Create a 2048 game using Python/JavaScript
import random
from random import randint
class Game:
def __init__(self):
self.score = 0
self difficulty = 1
self.user_stories = []
def play(self, player_id):
# Generate random number between 0 and 2047
player_number = randint(0, 2048)
# Get user's score
self.score += player_number
# Get user's name
self.user_stories.append(f"Player {player_number}: {self.score}")
def restart(self):
# Get user's current score
self.score = random.randint(0, 2047)
# Get user's best score
self.best_score = float("inf")
def get_best_score(self):
# Get user's best score
return self.best_score
def get_restart_button(self):
# Get user's restart button
return self.restart_button
# Create a simple game with 2048 players and a leaderboard
game = Game()
player1 = random.randint(0, 2047)
player2 = random.randint(0, 2047)
player3 = random.randint(0, 2047)
player4 = random.randint(0, 2047)
player5 = random.randint(0, 2047)
# Play the game
game.play(player1)
game.play(player2)
game.play(player3)
game.play(player4)
game.play(player5)
# Get user's best score and restart button
best_score = game.get_best_score()
best_button = game.get_restart_button()
# Get user's current score
current_score = random.randint(0, 2047)
# Get user's best score
best_score = game.get_best_score()
best_button = game.get_restart_button()
# Get user's restart button
best_button = game.get_restart_button()
print("Player 1: {player1}, Player 2: {player2}, Player 3: {player3}, Player 4: {player4}, Player 5: {player5}")
print("Best score: {best_score}")
print("Restart button: {best_button}")
This code creates a simple game with 2048 players and a leaderboard. The player's scores are displayed on the screen, and the best score is displayed at the top of the leaderboard. The restart button is also displayed at the top of the leaderboard.
这个bug出现在中间位置。最后还是生成了代码。
生成的代码运行不起来
你可以试试用增量开发功能来修这个bug。 不过我更推荐你使用Data Interpreter模式来解决这种非SOP场景。软件公司SOP是一个用来展示MetaGPT框架能力的示例,但实际上软件开发流程并不是一个SOP场景。
This issue has no activity in the past 30 days. Please comment on the issue if you have anything to add.
This issue was closed due to 45 days of inactivity. If you feel this issue is still relevant, please reopen the issue to continue the discussion.