Maplemx / Agently

[AI Agent Application Development Framework] - 🚀 Build AI agent native application in very few code 💬 Easy to interact with AI agent in code using structure data and chained-calls syntax 🧩 Enhance AI Agent using plugins instead of rebuild a whole new agent
http://agently.tech
Apache License 2.0
935 stars 105 forks source link

在showcase里运行样例jupyter代码,一直报错Exception in thread Thread-5 (start_in_theard): #38

Closed kapiya closed 7 months ago

kapiya commented 7 months ago

Exception in thread Thread-5 (start_in_theard): Traceback (most recent call last): File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/threading.py", line 953, in run self._target(self._args, self._kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/Agently/Agent/Agent.py", line 200, in start_in_theard reply = asyncio.get_event_loop().run_until_complete(self.start_async(request_type)) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/Agently/Agent/Agent.py", line 151, in start_async event_generator = await self.request.get_event_generator(request_type) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/Agently/Request/Request.py", line 104, in get_event_generator response_generator = request_plugin_export"request_model" File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/Agently/plugins/request/ERNIE.py", line 152, in request_model response = client.create(request_data) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/erniebot/resources/abc/creatable.py", line 32, in create return resource.create_resource(create_kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/erniebot/resources/abc/creatable.py", line 49, in create_resource resp = self.request( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/erniebot/resources/resource.py", line 134, in request return self._request( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/erniebot/resources/resource.py", line 363, in _request resp = self._backend.request( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/erniebot/backends/aistudio.py", line 84, in request return self._client.send_request( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/erniebot/http_client.py", line 131, in send_request result = self.send_request_raw( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/erniebot/http_client.py", line 236, in send_request_raw result = requests.request( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 791, in urlopen response = self._make_request( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 497, in _make_request conn.request( File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/urllib3/connection.py", line 394, in request self.putheader(header, value) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/urllib3/connection.py", line 308, in putheader super().putheader(header, values) File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/http/client.py", line 1255, in putheader values[i] = one_value.encode('latin-1') UnicodeEncodeError: 'latin-1' codec can't encode characters in position 7-15: ordinal not in range(256)

Empty Traceback (most recent call last) Cell In[1], line 24 20 break 21 ## 执行语言模型处理 22 result = agent\ 23 .input(user_input)\ ---> 24 .start() 25 ## 打印输出结果 26 print("[助理]: ", result)

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/Agently/Agent/Agent.py:205, in Agent.start(self, request_type) 203 theard.start() 204 theard.join()
--> 205 reply = reply_queue.get_nowait() 206 return reply

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/queue.py:199, in Queue.get_nowait(self) 193 def get_nowait(self): 194 '''Remove and return an item from the queue without blocking. 195 196 Only get an item if one is immediately available. Otherwise 197 raise the Empty exception. 198 ''' --> 199 return self.get(block=False)

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/queue.py:168, in Queue.get(self, block, timeout) 166 if not block: 167 if not self._qsize(): --> 168 raise Empty 169 elif timeout is None: 170 while not self._qsize():

Empty:

Maplemx commented 7 months ago

重启一下服务器实例,昨天晚上也有人遇到过,原因不明,重启就好了

Maplemx commented 7 months ago

经过排查,确认问题原因如下:

  1. 您在使用https://aistudio.baidu.com/projectdetail/7178289 项目进行试用的时候,没有修改/showcase/DEV.py 中的ACCESS-TOKEN (12-12版项目说明书没有提示您去修改,是我们写文档的疏忽,非常抱歉)
  2. 在DEV.py文件修改之后,需要手动重启内核才能生效(我们将同时在新版文档提示这一点)
  3. 因为我们在DEV.py文件中的修改提示为中文,而erniebot在处理ACCESS-TOKEN的时候,默认其为数字,导致未能正确抛出ACCESS-TOKEN错误,而是抛出了编码错误,这个问题已经向erniebot官方提出,由erniebot侧跟进修复
Maplemx commented 7 months ago

新版文档已经添加相关提示