geekan / MetaGPT

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
https://deepwisdom.ai/
MIT License
43.48k stars 5.17k forks source link

exp: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128) #1205

Closed welcomemonth closed 4 months ago

welcomemonth commented 4 months ago

(metagpt) PS D:\mbse\MetaGPT-1> metagpt "Create a 2048 game"
2024-04-17 17:58:20.411 | INFO | metagpt.const:get_metagpt_package_root:29 - Package root set to D:\mbse\MetaGPT-1 2024-04-17 17:58:31.194 | INFO | metagpt.team:invest:90 - Investment: $3.0. 2024-04-17 17:58:31.198 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do PrepareDocuments(PrepareDocuments) 2024-04-17 17:58:31.461 | INFO | metagpt.utils.file_repository:save:57 - save to: D:\mbse\MetaGPT-1\workspace\20240417175831\docs\requirement.txt 2024-04-17 17:58:31.464 | INFO | metagpt.roles.role:_act:391 - Alice(Product Manager): to do WritePRD(WritePRD) 2024-04-17 17:58:31.469 | INFO | metagpt.actions.write_prd:run:86 - New requirement detected: Create a 2048 game 2024-04-17 17:58:31.484 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 0.016(s), this was the 1st time calling it. exp: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128) 2024-04-17 17:58:31.513 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 0.047(s), this was the 2nd time calling it. exp: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128) 2024-04-17 17:58:31.993 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 0.532(s), this was the 3rd time calling it. exp: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128) 2024-04-17 17:58:32.089 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 0.625(s), this was the 4th time calling it. exp: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128) 2024-04-17 17:58:34.364 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 2.891(s), this was the 5th time calling it. exp: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128) 2024-04-17 17:58:40.165 | ERROR | metagpt.utils.common:log_it:554 - Finished call to 'metagpt.actions.action_node.ActionNode._aask_v1' after 8.704(s), this was the 6th time calling it. exp: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128) 2024-04-17 17:58:40.169 | 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-17 17:58:40.282 | ERROR | metagpt.utils.common:wrapper:631 - Exception occurs, start to serialize the project, exp: Traceback (most recent call last): File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "C:\Users\Dell.conda\envs\metagpt\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) UnicodeEncodeError: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128)

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

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\metagpt\utils\common.py", line 626, in wrapper result = await func(self, *args, kwargs) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\metagpt\team.py", line 134, in run await self.env.run() Exception: Traceback (most recent call last): File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, *kwargs) File "C:\Users\Dell.conda\envs\metagpt\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:\Users\Dell.conda\envs\metagpt\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:\Users\Dell.conda\envs\metagpt\lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped return await fn(args, kwargs) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\tenacity_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\tenacity__init.py", line 314, in iter return fut.result() File "C:\Users\Dell.conda\envs\metagpt\lib\concurrent\futures_base.py", line 439, in result return self.get_result() File "C:\Users\Dell.conda\envs\metagpt\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\tenacity_asyncio.py", line 50, in call result = await fn(*args, **kwargs) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\metagpt\provider\openai_api.py", line 141, in acompletion_text return await self._achat_completion_stream(messages, timeout=timeout) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\metagpt\provider\openai_api.py", line 79, in _achat_completion_stream response: AsyncStream[ChatCompletionChunk] = await self.aclient.chat.completions.create( File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\openai\resources\chat\completions.py", line 1295, in create return await self._post( File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\openai_base_client.py", line 1536, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\openai_base_client.py", line 1315, in request return await self._request( File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\openai_base_client.py", line 1335, in _request request = self._build_request(options) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\openai_base_client.py", line 447, in _build_request headers = self._build_headers(options) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\openai_base_client.py", line 408, in _build_headers headers = httpx.Headers(headers_dict) File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\httpx_models.py", line 72, in init__ self._list = [ File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\httpx_models.py", line 76, in normalize_header_value(v, encoding), File "C:\Users\Dell.conda\envs\metagpt\lib\site-packages\httpx_utils.py", line 53, in normalize_header_value return value.encode(encoding or "ascii") UnicodeEncodeError: 'ascii' codec can't encode character '\u200b' in position 58: ordinal not in range(128)

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

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

seehi commented 4 months ago

What's your python version? prefer 3.10 or 3.9 What output do you get if you put

import sys
print(sys.getdefaultencoding())
welcomemonth commented 4 months ago

What's your python version? prefer 3.10 or 3.9 What output do you get if you put

import sys
print(sys.getdefaultencoding())

Thank you, brother. The problem has been resolved because my configuration was not properly set up. I don't know why this error occurred.