Open yueyin19960520 opened 9 months ago
You can try setting OPENAI_API_VERSION: "2020-11-07" in the key.yaml file.
Hi, my guess is the installed metagpt
in your environment points to D:\share\MetaGPT\metagpt
, whereas your are running the examples under D:\share\MetaGPT\MetaGPT-werewolf_game
. You can git checkout werewolf_game
branch under D:\share\MetaGPT
and run python .\examples\werewolf_game\start_game.py
I have the same problem with you
You can try setting OPENAI_API_VERSION: "2020-11-07" in the key.yaml file.
I have tried this, but it didn't work
Hi, my guess is the installed
metagpt
in your environment points toD:\share\MetaGPT\metagpt
, whereas your are running the examples underD:\share\MetaGPT\MetaGPT-werewolf_game
. You can git checkoutwerewolf_game
branch underD:\share\MetaGPT
and runpython .\examples\werewolf_game\start_game.py
does not work either
Hi, my guess is the installed
metagpt
in your environment points toD:\share\MetaGPT\metagpt
, whereas your are running the examples underD:\share\MetaGPT\MetaGPT-werewolf_game
. You can git checkoutwerewolf_game
branch underD:\share\MetaGPT
and runpython .\examples\werewolf_game\start_game.py
does not work either
What's the error?
Hi, my guess is the installed
metagpt
in your environment points toD:\share\MetaGPT\metagpt
, whereas your are running the examples underD:\share\MetaGPT\MetaGPT-werewolf_game
. You can git checkoutwerewolf_game
branch underD:\share\MetaGPT
and runpython .\examples\werewolf_game\start_game.py
does not work either
What's the error?
2024-01-13 18:28:48.759 | INFO | metagpt.provider.openai_api:_achat_completion_stream:171 - <module 'openai' from '/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/openai/init.py'> Traceback (most recent call last): File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, kwargs) File "/Users/VscodeProjects/MetaGPT/examples/werewolf_game/actions/common_actions.py", line 213, in run rsp = await self._aask(prompt) File "/Users/VscodeProjects/MetaGPT/metagpt/actions/action.py", line 51, in _aask return await self.llm.aask(prompt, system_msgs) File "/Users/VscodeProjects/MetaGPT/metagpt/provider/base_gpt_api.py", line 45, in aask rsp = await self.acompletion_text(message, stream=True) File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, *kwargs) File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/tenacity/init.py", line 314, in iter return fut.result() File "/Users/.pyenv/versions/3.9.17/lib/python3.9/concurrent/futures/_base.py", line 439, in result return self.get_result() File "/Users/.pyenv/versions/3.9.17/lib/python3.9/concurrent/futures/_base.py", line 391, in get_result raise self._exception File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in call result = await fn(args, kwargs) File "/Users/VscodeProjects/MetaGPT/metagpt/provider/openai_api.py", line 248, in acompletion_text return await self._achat_completion_stream(messages) File "/Users/VscodeProjects/MetaGPT/metagpt/provider/openai_api.py", line 172, in _achat_completion_stream response = await openai.ChatCompletion.acreate(*kwargs) File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/openai/api_resources/chat_completion.py", line 45, in acreate return await super().acreate(args, **kwargs) File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/openai/api_resources/abstract/engine_apiresource.py", line 217, in acreate response, , api_key = await requestor.arequest( File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/openai/api_requestor.py", line 382, in arequest resp, got_stream = await self._interpret_async_response(result, stream) File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/openai/api_requestor.py", line 728, in _interpret_async_response self._interpret_response_line( File "/Users/.pyenv/versions/3.9.17/lib/python3.9/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: Unsupported OpenAI-Version header provided: 2. (HINT: you can provide any of the following supported versions: 2020-10-01, 2020-11-07. Alternatively, you can simply omit this header to use the default version associated with your account.)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/VscodeProjects/MetaGPT/examples/werewolf_game/start_game.py", line 74, in
same here, any solution?
I built werewolf game with new MetaGPT myself. Check here: https://github.com/WuJunde/werewolf_ai_agents if anyone is interested.
if I run this : (agent) PS D:\share\MetaGPT\MetaGPT-werewolf_game> python .\examples\werewolf_game\start_game.py
I got: Traceback (most recent call last): File "D:\share\MetaGPT\MetaGPT-werewolf_game\examples\werewolf_game\start_game.py", line 7, in
from examples.werewolf_game.werewolf_game import WerewolfGame
ModuleNotFoundError: No module named 'examples.werewolf_game'
I copy the start_game to MetaGPT-werewolf_game dir, rerun it: (agent) PS D:\share\MetaGPT\MetaGPT-werewolf_game> python .\start_game.py
I got this: 2023-11-13 18:02:33.722 | INFO | metagpt.config:init:44 - Config loading done. 2023-11-13 18:02:37.072 | INFO | metagpt.software_company:invest:39 - Investment: $20.0. 2023-11-13 18:02:37.074 | INFO | examples.werewolf_game.roles.moderator:_act:216 - Moderator(Moderator) ready to InstructSpeak 2023-11-13 18:02:37.075 | INFO | examples.werewolf_game.roles.moderator:_record_game_history:187 - a night and day cycle completed, examine all history (User): 0 | Game setup: Player1: Werewolf, Player2: Seer, Player3: Villager, Player4: Werewolf, Player5: Witch, Player6: Villager, Player7: Guard, 2023-11-13 18:02:37.077 | INFO | examples.werewolf_game.roles.moderator:_act:243 - Moderator(Moderator): It’s dark, everyone close your eyes. I will talk with you/your team secretly at night. 2023-11-13 18:02:37.080 | INFO | examples.werewolf_game.roles.moderator:_act:216 - Moderator(Moderator) ready to InstructSpeak 2023-11-13 18:02:37.083 | INFO | examples.werewolf_game.roles.moderator:_act:243 - Moderator(Moderator): Guard, please open your eyes! 2023-11-13 18:02:37.086 | INFO | examples.werewolf_game.roles.moderator:_act:216 - Moderator(Moderator) ready to InstructSpeak 2023-11-13 18:02:37.087 | INFO | examples.werewolf_game.roles.moderator:_act:243 - Moderator(Moderator): Guard, now tell me who you protect tonight? You only choose one from the following living options please: ['Player1', 'Player2', 'Player3', 'Player4', 'Player5', 'Player6', 'Player7']. Or you can pass. For example: Protect ... 2023-11-13 18:02:37.090 | INFO | examples.werewolf_game.roles.base_player:_act:70 - Player7(Guard): ready to Protect Traceback (most recent call last): File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, kwargs) File "D:\share\MetaGPT\MetaGPT-werewolf_game\examples\werewolf_game\actions\common_actions.py", line 211, in run rsp = await self._aask(prompt) File "D:\share\MetaGPT\MetaGPT-werewolf_game\metagpt\actions\action.py", line 50, in _aask return await self.llm.aask(prompt, system_msgs) File "D:\share\MetaGPT\MetaGPT-werewolf_game\metagpt\provider\base_gpt_api.py", line 44, in aask rsp = await self.acompletion_text(message, stream=True) File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped return await fn(*args, *kwargs) File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity__init.py", line 314, in iter return fut.result() File "D:\Anaconda3\envs\agent\lib\concurrent\futures_base.py", line 439, in result return self.get_result() File "D:\Anaconda3\envs\agent\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity_asyncio.py", line 50, in call__ result = await fn(args, kwargs) File "D:\share\MetaGPT\MetaGPT-werewolf_game\metagpt\provider\openai_api.py", line 238, in acompletion_text return await self._achat_completion_stream(messages) File "D:\share\MetaGPT\MetaGPT-werewolf_game\metagpt\provider\openai_api.py", line 163, in _achat_completion_stream response = await openai.ChatCompletion.acreate(*self._cons_kwargs(messages), stream=True) File "D:\Anaconda3\envs\agent\lib\site-packages\openai\api_resources\chat_completion.py", line 45, in acreate return await super().acreate(args, **kwargs) File "D:\Anaconda3\envs\agent\lib\site-packages\openai\api_resources\abstract\engine_apiresource.py", line 217, in acreate response, , api_key = await requestor.arequest( File "D:\Anaconda3\envs\agent\lib\site-packages\openai\api_requestor.py", line 382, in arequest resp, got_stream = await self._interpret_async_response(result, stream) File "D:\Anaconda3\envs\agent\lib\site-packages\openai\api_requestor.py", line 726, in _interpret_async_response self._interpret_response_line( File "D:\Anaconda3\envs\agent\lib\site-packages\openai\api_requestor.py", line 763, in _interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: Unsupported OpenAI-Version header provided: 2. (HINT: you can provide any of the following supported versions: 2020-10-01, 2020-11-07. Alternatively, you can simply omit this header to use the default version associated with your account.)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "D:\share\MetaGPT\MetaGPT-werewolf_game\start_game.py", line 74, in
fire.Fire(main)
File "D:\Anaconda3\envs\agent\lib\site-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 "D:\Anaconda3\envs\agent\lib\site-packages\fire-0.4.0-py3.9.egg\fire\core.py", line 466, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "D:\Anaconda3\envs\agent\lib\site-packages\fire-0.4.0-py3.9.egg\fire\core.py", line 681, in _CallAndUpdateTrace
component = fn(*varargs, *kwargs)
File "D:\share\MetaGPT\MetaGPT-werewolf_game\start_game.py", line 69, in main
asyncio.run(start_game(investment, n_round, shuffle, add_human,
File "D:\Anaconda3\envs\agent\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\Anaconda3\envs\agent\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "D:\share\MetaGPT\MetaGPT-werewolf_game\start_game.py", line 63, in start_game
await game.run(n_round=n_round)
File "D:\share\MetaGPT\MetaGPT-werewolf_game\metagpt\software_company.py", line 60, in run
await self.environment.run()
File "D:\share\MetaGPT\MetaGPT-werewolf_game\examples\werewolf_game\werewolf_game.py", line 28, in run
await role.run()
File "D:\share\MetaGPT\MetaGPT-werewolf_game\metagpt\roles\role.py", line 249, in run
rsp = await self._react()
File "D:\share\MetaGPT\MetaGPT-werewolf_game\metagpt\roles\role.py", line 218, in _react
return await self._act()
File "D:\share\MetaGPT\MetaGPT-werewolf_game\examples\werewolf_game\roles\base_player.py", line 77, in _act
reflection = await Reflect().run(
File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped
return await fn(args, **kwargs)
File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity_asyncio.py", line 47, in call
do = self.iter(retry_state=retry_state)
File "D:\Anaconda3\envs\agent\lib\site-packages\tenacity__init__.py", line 326, in iter
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x21e34f85250 state=finished raised InvalidRequestError>]
I can run metagpt: (agent) PS D:\share\MetaGPT> python .\startup.py "snake game" 2023-11-13 18:04:01.190 | INFO | metagpt.config:init:44 - Config loading done. 2023-11-13 18:04:04.239 | INFO | metagpt.software_company:invest:39 - Investment: $3.0. 2023-11-13 18:04:04.241 | INFO | metagpt.roles.role:_act:167 - Alice(Product Manager): ready to WritePRD [CONTENT] { "Original Requirements": "The boss wants a snake game.", "Product Goals": ["Create a simple and engaging snake game", "Ensure the game is easy to learn but hard to master", "Optimize the game for mobile platforms"], "User Stories": ["As a user, I want to easily control the snake so I can play the game without difficulty.", "As a user, I want the game to become progressively harder, so I can be challenged and engaged.", "As a user, I want to be able to pause and resume the game, so I can play at my own convenience.", "As a user, I want to see my high scores, so I can track my progress and aim to beat my previous scores.", "As a user, I want the game to have a clean and simple interface, so it's easy to navigate."], "Competitive Analysis": ["Snake '97: This game is a modern remake of the original Snake, complete with dot-matrix display and monotone sounds. It's appealing for its nostalgia factor.", "Slither.io: This game takes the classic Snake concept and expands it into a multiplayer online game. It's engaging due to its competitive aspect.", "Snake VS Block: This game adds a new twist to the Snake game by introducing blocks that the snake has to break through. It's unique and challenging.", "Nimble Quest: This game combines the snake concept with RPG elements, making it more complex and engaging.", "Snake Rivals: This is another multiplayer snake game, but with more modern graphics and additional gameplay features."],
I cannot figure out the problem, thanks for your helping!