MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

metegpt +ollama ,in window 10,can not run

Open boagolden opened this issue 9 months ago • 1 comments

Bug description I encountered an error when using MetaGPT to call the local ollama, and it failed to function. However, directly invoking ollama using Python works fine.

Environment information win 10 config2.yaml: llm: api_type: "ollama" model: "gemma:2b" base_url: "http://localhost:11434" api_key: "ollama" RPM: 3

  • LLM type and model name:ollama gemma:2b
  • System version:win 10
  • Python version:Python 3.12.3
  • MetaGPT version or branch:metagpt-0.8.1-py3-none-any.whl.metadata
  • use pip install metagpt
  • packages version:
  • installation method:

Screenshots or logs D:\mymetagpt\MetaGPT>metagpt "Create a 2048 game" 2024-04-30 09:37:00.803 | INFO | metagpt.const:get_metagpt_package_root:29 - Package root set to D:\mymetagpt\MetaGPT 2024-04-30 09:37:04.151 | INFO | metagpt.team:invest:90 - Investment: $3.0. 2024-04-30 09:37:04.154 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do PrepareDocuments(PrepareDocuments) 2024-04-30 09:37:04.430 | INFO | metagpt.utils.file_repository:save:57 - save to: D:\mymetagpt\MetaGPT\workspace\20240430093704\docs\requirement.txt 2024-04-30 09:37:04.432 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do WritePRD(WritePRD) 2024-04-30 09:37:04.434 | INFO | metagpt.actions.write_prd:run:86 - New requirement detected: Create a 2048 game 2024-04-30 09:37:04.477 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 0.031(s), this was the 1st time calling it. exp: 'async for' requires an object with aiter method, got bytes 2024-04-30 09:37:05.298 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 0.859(s), this was the 2nd time calling it. exp: 'async for' requires an object with aiter method, got bytes 2024-04-30 09:37:07.103 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 2.656(s), this was the 3rd time calling it. exp: 'async for' requires an object with aiter method, got bytes 2024-04-30 09:37:11.087 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 6.641(s), this was the 4th time calling it. exp: 'async for' requires an object with aiter method, got bytes 2024-04-30 09:37:11.567 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 7.125(s), this was the 5th time calling it. exp: 'async for' requires an object with aiter method, got bytes 2024-04-30 09:37:21.194 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 16.750(s), this was the 6th time calling it. exp: 'async for' requires an object with aiter method, got bytes 2024-04-30 09:37:21.196 | 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. 2024-04-30 09:37:21.200 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "C:\Python310\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "C:\Python310\lib\site-packages\metagpt\actions\action_node.py", line 420, in _aask_v1 content = await self.llm.aask(prompt, system_msgs, images=images, timeout=timeout) TypeError: 'async for' requires an object with aiter method, got bytes

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

Traceback (most recent call last): File "C:\Python310\lib\site-packages\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "C:\Python310\lib\site-packages\metagpt\roles\role.py", line 550, in run rsp = await self.react() tenacity.RetryError: RetryError[<Future at 0x2690458f820 state=finished raised TypeError>]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python310\lib\site-packages\metagpt\utils\common.py", line 626, in wrapper result = await func(self, *args, **kwargs) File "C:\Python310\lib\site-packages\metagpt\team.py", line 134, in run await self.env.run() Exception: Traceback (most recent call last): File "C:\Python310\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "C:\Python310\lib\site-packages\metagpt\actions\action_node.py", line 420, in aask_v1 content = await self.llm.aask(prompt, system_msgs, images=images, timeout=timeout) File "C:\Python310\lib\site-packages\metagpt\provider\base_llm.py", line 150, in aask rsp = await self.acompletion_text(message, stream=stream, timeout=self.get_timeout(timeout)) File "C:\Python310\lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) File "C:\Python310\lib\site-packages\tenacity_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "C:\Python310\lib\site-packages\tenacity_init.py", line 314, in iter return fut.result() File "C:\Python310\lib\concurrent\futures_base.py", line 451, in result return self.__get_result() File "C:\Python310\lib\concurrent\futures_base.py", line 403, in __get_result raise self._exception File "C:\Python310\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "C:\Python310\lib\site-packages\metagpt\provider\base_llm.py", line 200, in acompletion_text return await self._achat_completion_stream(messages, timeout=self.get_timeout(timeout)) File "C:\Python310\lib\site-packages\metagpt\provider\ollama_api.py", line 79, in _achat_completion_stream async for raw_chunk in stream_resp: TypeError: 'async for' requires an object with aiter method, got bytes

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

Traceback (most recent call last): File "C:\Python310\lib\site-packages\metagpt\utils\common.py", line 640, in wrapper return await func(self, *args, **kwargs) File "C:\Python310\lib\site-packages\metagpt\roles\role.py", line 550, in run rsp = await self.react() File "C:\Python310\lib\site-packages\metagpt\roles\role.py", line 517, in react rsp = await self._react() File "C:\Python310\lib\site-packages\metagpt\roles\role.py", line 463, in _react rsp = await self._act() File "C:\Python310\lib\site-packages\metagpt\roles\role.py", line 392, in _act response = await self.rc.todo.run(self.rc.history) File "C:\Python310\lib\site-packages\metagpt\actions\write_prd.py", line 87, in run return await self._handle_new_requirement(req) File "C:\Python310\lib\site-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 "C:\Python310\lib\site-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 "C:\Python310\lib\site-packages\metagpt\actions\action_node.py", line 457, in simple_fill content, scontent = await self.aask_v1( File "C:\Python310\lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) File "C:\Python310\lib\site-packages\tenacity_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "C:\Python310\lib\site-packages\tenacity_init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x2690458f820 state=finished raised TypeError>]

boagolden avatar Apr 30 '24 01:04 boagolden

https://github.com/geekan/MetaGPT/issues/1218

taozhiyuai avatar Apr 30 '24 11:04 taozhiyuai