[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
其中一段错误是:
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\core_http_client.py", line 251, in request
raise self._make_status_error(err.response) from None
zhipuai.core._errors.APIRequestFailedError: Error code: 400, with error text {"error":{"code":"1214","message":"messages[4]:content和tool_calls 字段不能同时为空"}}
正常第三次问题应该是先调用路由agent,是没用配置tool内容的,但这个错误让人很疑惑;
完整的错误信息:
Exception in thread Thread-15:
Traceback (most recent call last):
File "D:\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "D:\Python\Python39\lib\threading.py", line 910, in run
self._target(*self._args, self._kwargs)
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Agent\Agent.py", line 232, in start_in_theard
reply = loop.run_until_complete(self.start_async(request_type))
File "D:\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Agent\Agent.py", line 220, in start_async
raise(e)
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Agent\Agent.py", line 173, in start_async
event_generator = await self.request.get_event_generator(request_type)
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Request\Request.py", line 116, in get_event_generator
response_generator = await request_plugin_export"request_model"
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\plugins\request\ZhipuAI.py", line 193, in request_model
return client.chat.completions.create(request_data)
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\api_resource\chat\completions.py", line 48, in create
return self._post(
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\core_http_client.py", line 292, in post
return self.request(
File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\core_http_client.py", line 251, in request
raise self._make_status_error(err.response) from None
zhipuai.core._errors.APIRequestFailedError: Error code: 400, with error text {"error":{"code":"1214","message":"messages[4]:content和tool_calls 字段不能同时为空"}}
Traceback (most recent call last):
File "D:\MyPythonCode\Agent_chat\agent_llm\agent_role.py", line 192, in
result=ai_response(question,history)
File "D:\MyPythonCode\Agent_chat\agent_llm\agent_role.py", line 179, in ai_response
if route_agent(question,history)=='制度流程查询':
File "D:\MyPythonCode\Agent_chat\agent_llm\agent_role.py", line 18, in route_agent
print('路由判断',route['intention'])
TypeError: 'NoneType' object is not subscriptable
我这里一共使用了三个agent:版本3.2.2.3
路由agent:判断用户意图,是否需要调用制度查询; 闲聊agent,就是一个正常的agent,做了一些配置 带有知识库向量查询的agent;
然后放在一个循环里面测试答案;基本 第一次:你好; 第二次:查XXXXX制度 第三次:我刚才问了什么问题, 每次到第三次就开始报错崩溃;
其中一段错误是: File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\core_http_client.py", line 251, in request raise self._make_status_error(err.response) from None zhipuai.core._errors.APIRequestFailedError: Error code: 400, with error text {"error":{"code":"1214","message":"messages[4]:content和tool_calls 字段不能同时为空"}}
正常第三次问题应该是先调用路由agent,是没用配置tool内容的,但这个错误让人很疑惑;
完整的错误信息: Exception in thread Thread-15: Traceback (most recent call last): File "D:\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner self.run() File "D:\Python\Python39\lib\threading.py", line 910, in run self._target(*self._args, self._kwargs) File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Agent\Agent.py", line 232, in start_in_theard reply = loop.run_until_complete(self.start_async(request_type)) File "D:\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete return future.result() File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Agent\Agent.py", line 220, in start_async raise(e) File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Agent\Agent.py", line 173, in start_async event_generator = await self.request.get_event_generator(request_type) File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\Request\Request.py", line 116, in get_event_generator response_generator = await request_plugin_export"request_model" File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\Agently\plugins\request\ZhipuAI.py", line 193, in request_model return client.chat.completions.create(request_data) File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\api_resource\chat\completions.py", line 48, in create return self._post( File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\core_http_client.py", line 292, in post return self.request( File "D:\MyPythonCode\Agent_chat\venv\lib\site-packages\zhipuai\core_http_client.py", line 251, in request raise self._make_status_error(err.response) from None zhipuai.core._errors.APIRequestFailedError: Error code: 400, with error text {"error":{"code":"1214","message":"messages[4]:content和tool_calls 字段不能同时为空"}} Traceback (most recent call last): File "D:\MyPythonCode\Agent_chat\agent_llm\agent_role.py", line 192, in
result=ai_response(question,history)
File "D:\MyPythonCode\Agent_chat\agent_llm\agent_role.py", line 179, in ai_response
if route_agent(question,history)=='制度流程查询':
File "D:\MyPythonCode\Agent_chat\agent_llm\agent_role.py", line 18, in route_agent
print('路由判断',route['intention'])
TypeError: 'NoneType' object is not subscriptable