Can MetaGPT still running on colab?
Bug description
Run the example Colab on Quickstart and install it using !pip install --upgrade metagpt.
But got some error.
Bug solved method
https://colab.research.google.com/drive/1xlReN7EIpKzgZO1If29-zsw7QNUUfEbx?usp=sharing
Environment information
- LLM type and model name:
gpt-4-1106-preview - System version:
colab - Python version:
3.10.12 - MetaGPT version or branch:
newest
- packages version:
- installation method:
!pip install --upgrade metagpt
Screenshots or logs
2025-01-13 13:21:18.135 | INFO | metagpt.team:invest:90 - Investment: $3.0. 2025-01-13 13:21:18.142 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do PrepareDocuments(PrepareDocuments) 2025-01-13 13:21:18.176 | INFO | metagpt.utils.file_repository:save:57 - save to: /usr/local/lib/python3.10/dist-packages/workspace/20250113132118/docs/requirement.txt 2025-01-13 13:21:18.182 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do WritePRD(WritePRD) 2025-01-13 13:21:18.187 | INFO | metagpt.actions.write_prd:run:86 - New requirement detected: write a 2048 game 2025-01-13 13:21:26.995 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 8.805(s), this was the 1st time calling it. exp: 400 Unknown error trying to retrieve streaming response. Please retry with
stream=Falsefor more details. 2025-01-13 13:21:35.140 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 16.950(s), this was the 2nd time calling it. exp: 400 Unknown error trying to retrieve streaming response. Please retry withstream=Falsefor more details. 2025-01-13 13:21:44.283 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 26.093(s), this was the 3rd time calling it. exp: 400 Unknown error trying to retrieve streaming response. Please retry withstream=Falsefor more details. 2025-01-13 13:21:49.758 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 31.568(s), this was the 4th time calling it. exp: 400 Unknown error trying to retrieve streaming response. Please retry withstream=Falsefor more details. 2025-01-13 13:22:01.147 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 42.957(s), this was the 5th time calling it. exp: 400 Unknown error trying to retrieve streaming response. Please retry withstream=Falsefor more details. 2025-01-13 13:22:19.540 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 61.350(s), this was the 6th time calling it. exp: 400 Unknown error trying to retrieve streaming response. Please retry withstream=Falsefor more details. 2025-01-13 13:22:19.541 | 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. 2025-01-13 13:22:19.554 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/google/generativeai/types/generation_types.py", line 385, in rewrite_stream_error yield File "/usr/local/lib/python3.10/dist-packages/google/generativeai/generative_models.py", line 263, in generate_content_async iterator = await self._async_client.stream_generate_content( AttributeError: 'ResponseIterator' object has no attribute 'await'. Did you mean: 'init'?During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/metagpt/actions/action_node.py", line 420, in _aask_v1 content = await self.llm.aask(prompt, system_msgs, images=images, timeout=timeout) google.api_core.exceptions.BadRequest: 400 Unknown error trying to retrieve streaming response. Please retry with
stream=Falsefor more details.The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/metagpt/utils/common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/metagpt/roles/role.py", line 550, in run rsp = await self.react() tenacity.RetryError: RetryError[<Future at 0x7848cbac7820 state=finished raised BadRequest>]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/metagpt/utils/common.py", line 626, in wrapper result = await func(self, *args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/metagpt/team.py", line 134, in run await self.env.run() Exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/google/generativeai/types/generation_types.py", line 385, in rewrite_stream_error yield File "/usr/local/lib/python3.10/dist-packages/google/generativeai/generative_models.py", line 263, in generate_content_async iterator = await self._async_client.stream_generate_content( File "/usr/local/lib/python3.10/dist-packages/google/api_core/retry/retry_unary_async.py", line 230, in retry_wrapped_func return await retry_target( File "/usr/local/lib/python3.10/dist-packages/google/api_core/retry/retry_unary_async.py", line 160, in retry_target _retry_error_helper( File "/usr/local/lib/python3.10/dist-packages/google/api_core/retry/retry_base.py", line 212, in _retry_error_helper raise final_exc from source_exc File "/usr/local/lib/python3.10/dist-packages/google/api_core/retry/retry_unary_async.py", line 155, in retry_target return await target() File "/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers_async.py", line 85, in await response = yield from self._call.await() AttributeError: 'ResponseIterator' object has no attribute 'await'. Did you mean: 'init'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/metagpt/actions/action_node.py", line 420, in _aask_v1 content = await self.llm.aask(prompt, system_msgs, images=images, timeout=timeout) File "/usr/local/lib/python3.10/dist-packages/metagpt/provider/base_llm.py", line 150, in aask rsp = await self.acompletion_text(message, stream=stream, timeout=self.get_timeout(timeout)) File "/usr/local/lib/python3.10/dist-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "/usr/local/lib/python3.10/dist-packages/tenacity/init.py", line 314, in iter return fut.result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.__get_result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/usr/local/lib/python3.10/dist-packages/tenacity/_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/metagpt/provider/base_llm.py", line 200, in acompletion_text return await self._achat_completion_stream(messages, timeout=self.get_timeout(timeout)) File "/usr/local/lib/python3.10/dist-packages/metagpt/provider/google_gemini_api.py", line 141, in _achat_completion_stream resp: AsyncGenerateContentResponse = await self.llm.generate_content_async( File "/usr/local/lib/python3.10/dist-packages/google/generativeai/generative_models.py", line 262, in generate_content_async with generation_types.rewrite_stream_error(): File "/usr/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.10/dist-packages/google/generativeai/types/generation_types.py", line 387, in rewrite_stream_error raise google.api_core.exceptions.BadRequest( google.api_core.exceptions.BadRequest: 400 Unknown error trying to retrieve streaming response. Please retry with
stream=Falsefor more details.The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/metagpt/utils/common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/metagpt/roles/role.py", line 550, in run rsp = await self.react() File "/usr/local/lib/python3.10/dist-packages/metagpt/roles/role.py", line 517, in react rsp = await self._react() File "/usr/local/lib/python3.10/dist-packages/metagpt/roles/role.py", line 463, in _react rsp = await self._act() File "/usr/local/lib/python3.10/dist-packages/metagpt/roles/role.py", line 392, in _act response = await self.rc.todo.run(self.rc.history) File "/usr/local/lib/python3.10/dist-packages/metagpt/actions/write_prd.py", line 87, in run return await self._handle_new_requirement(req) File "/usr/local/lib/python3.10/dist-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 "/usr/local/lib/python3.10/dist-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 "/usr/local/lib/python3.10/dist-packages/metagpt/actions/action_node.py", line 457, in simple_fill content, scontent = await self._aask_v1( File "/usr/local/lib/python3.10/dist-packages/tenacity/_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/tenacity/_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "/usr/local/lib/python3.10/dist-packages/tenacity/init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x7848cbac7820 state=finished raised BadRequest>]
Based on the log /usr/local/lib/python3.10/dist-packages/metagpt/provider/google_gemini_api.py, I infer that you are probably using the Gemini model instead of gpt-4-1106-preview.
Could you please post your config2.yaml configuration?
Oh! Thanks, it worked after I adjusted my config2.yaml.
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.