MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

the Bug source:python examples/di/imitate_webpage.py is Incomplete, shutdown error info

Open xjspace opened this issue 1 year ago • 3 comments
trafficstars

Bug description

  • LLM type and model name:

  • openai

  • model: "gpt-4-1106-preview"

  • Python 3.10:

  • packages version:

  • MetaGPT 0.76

Screenshots or code logs `File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/roles/di/data_interpreter.py", line 46, in _act_on_task code, result, is_success = await self._write_and_exec_code() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/roles/di/data_interpreter.py", line 58, in _write_and_exec_code self.working_memory.add(Message(content=code["code"], role="assistant", cause_by=cause_by)) ~~~~^^^^^^^^ KeyError: 'code'

During handling of the above exception, another exception occurred:`

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/data/MetaGPT/examples/di/imitate_webpage.py", line 25, in asyncio.run(main()) File "/home/miniconda3/envs/metaGpt/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/data/MetaGPT/examples/di/imitate_webpage.py", line 19, in main await di.run(prompt) File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/utils/common.py", line 585, in wrapper raise Exception(format_trackback_info(limit=None)) Exception: Traceback (most recent call last): File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/utils/common.py", line 563, in wrapper return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/roles/role.py", line 558, in run rsp = await self.react() ^^^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/roles/role.py", line 529, in react rsp = await self._plan_and_act() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/roles/role.py", line 497, in _plan_and_act task_result = await self._act_on_task(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/roles/di/data_interpreter.py", line 46, in _act_on_task code, result, is_success = await self._write_and_exec_code() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/miniconda3/envs/metaGpt/lib/python3.11/site-packages/metagpt/roles/di/data_interpreter.py", line 58, in _write_and_exec_code self.working_memory.add(Message(content=code["code"], role="assistant", cause_by=cause_by)) ~~~~^^^^^^^^ KeyError: 'code'

(metaGpt) root@xjspace:/data/MetaGPT# [IPKernelApp] WARNING | Parent appears to have exited, shutting down.

xjspace avatar Mar 14 '24 07:03 xjspace

Previous version of code variable is a dict, but it is changed to a string and properly handled. Try pulling the latest codes and this issue should be fixed.

garylin2099 avatar Mar 14 '24 09:03 garylin2099

Previous version of code variable is a dict, but it is changed to a string and properly handled. Try pulling the latest codes and this issue should be fixed. I'll give it a try

xjspace avatar Mar 14 '24 12:03 xjspace

@xjspace Can you confirm that this issue has been resolved?

geekan avatar Mar 21 '24 03:03 geekan