Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in task_handler 和 NoneType 错误 #391

Open
Fishday17 opened this issue Mar 22, 2024 · 1 comment
Open

Error in task_handler 和 NoneType 错误 #391

Fishday17 opened this issue Mar 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Fishday17
Copy link

Issue Description / 问题描述

用GTP3.5 显示的事Erro in task....
用GPT4 则出现 NoneType错误。 / 请详细描述您遇到的错误或问题。

Steps to Reproduce / 复现步骤

在codebase, 严格按照示例走。 用的命令行,提示词是:
Search the rank of Tsinghua University in computer science field.

Please provide the specific steps to reproduce the error. / 请提供复现错误的具体步骤。

Expected Behavior / 预期行为

Describe the behavior you expected to see. / 请描述您期望的正确行为。

Environment / 环境信息

github上的 codespace
conda
docker compose

  • Operating System / 操作系统:
  • Python Version / Python 版本:
  • Other Relevant Information / 其他相关信息:

Error Screenshots or Logs / 错误截图或日志

GPT 4:
-=-=-=-=-=-=-= GENERATE INITIAL_PLAN -=-=-=-=-=-=-=
Constructing an Agent: PlanGenerateAgent
chatcompletion: using gpt-4
Traceback (most recent call last):
File "/workspaces/XAgent/XAgentServer/server.py", line 104, in interact
task_handler.outer_loop()
File "/workspaces/XAgent/XAgent/workflow/task_handler.py", line 82, in outer_loop
self.plan_agent.initial_plan_generation(
File "/workspaces/XAgent/XAgent/workflow/plan_exec.py", line 164, in initial_plan_generation
new_message , _ = agent.parse(
^^^^^^^^^^^^
File "/workspaces/XAgent/XAgent/agent/plan_generate_agent/agent.py", line 49, in parse
return self.generate(
^^^^^^^^^^^^^^
File "/workspaces/XAgent/XAgent/agent/base_agent.py", line 121, in generate
response = objgenerator.chatcompletion(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/tenacity/init.py", line 289, in wrapped_f
return self(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/tenacity/init.py", line 379, in call
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/tenacity/init.py", line 314, in iter
return fut.result()
^^^^^^^^^^^^
File "/opt/conda/envs/xagent/lib/python3.11/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/xagent/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/tenacity/init.py", line 382, in call
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/workspaces/XAgent/XAgent/ai_functions/request/obj_generator.py", line 72, in chatcompletion
response = self.function_call_refine(kwargs,response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/XAgent/XAgent/ai_functions/request/obj_generator.py", line 194, in function_call_refine
function_schema = list(filter(lambda x: x['name'] == response['choices'][0]['message']['function_call']['name'],req_kwargs['functions']))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/XAgent/XAgent/ai_functions/request/obj_generator.py", line 194, in
function_schema = list(filter(lambda x: x['name'] == response['choices'][0]['message']['function_call']['name'],req_kwargs['functions']))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

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

Traceback (most recent call last):
File "/workspaces/XAgent/command.py", line 273, in task_handler
server.interact(interaction=interaction)
File "/workspaces/XAgent/XAgentServer/server.py", line 106, in interact
raise XAgentRunningError(str(e)) from e
XAgentServer.exts.exception_ext.XAgentRunningError: 'NoneType' object is not subscriptable
Error in task_handler of 1efc760dc4ea43c2a93b0f1a0bbda3b7: 'NoneType' object is not subscriptable

=================
GPT 3.5
-=-=-=-=-=-=-= GENERATE INITIAL_PLAN -=-=-=-=-=-=-=
Constructing an Agent: PlanGenerateAgent
chatcompletion: using gpt-3.5-turbo-16k
Traceback (most recent call last):
File "/workspaces/XAgent/XAgentServer/server.py", line 104, in interact
task_handler.outer_loop()
File "/workspaces/XAgent/XAgent/workflow/task_handler.py", line 82, in outer_loop
self.plan_agent.initial_plan_generation(
File "/workspaces/XAgent/XAgent/workflow/plan_exec.py", line 178, in initial_plan_generation
subtasks = json5.loads(new_message["function_call"]["arguments"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/lib.py", line 106, in loads
ast, err, _ = parser.parse()
^^^^^^^^^^^^^^
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 19, in parse
self.grammar()
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 160, in grammar
self._seq(
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 102, in _seq
rule()
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 172, in sp
self._star(self.ws)
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 93, in _star
rule()
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 175, in ws
self._choose(
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 109, in _choose
rule()
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 190, in ws__c0
self._ch(' ')
File "/opt/conda/envs/xagent/lib/python3.11/site-packages/json5/parser.py", line 117, in _ch
if p < self.end and self.msg[p] == ch:
~~~~~~~~^^^
KeyError: 0

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

Traceback (most recent call last):
File "/workspaces/XAgent/command.py", line 273, in task_handler
server.interact(interaction=interaction)
File "/workspaces/XAgent/XAgentServer/server.py", line 106, in interact
raise XAgentRunningError(str(e)) from e
XAgentServer.exts.exception_ext.XAgentRunningError: 0
Error in task_handler of 5cd5ce8d237245ee8d67164618d20d18: 0

If possible, please provide relevant screenshots or logs of the error. / 如果可能,请提供相关的错误截图或日志文件。

Additional Notes / 其他备注

If you have any additional information or notes, please add them here. / 如果有其他补充信息,请在此处添加。

@Fishday17 Fishday17 added the bug Something isn't working label Mar 22, 2024
@zhaichenhao1889
Copy link

the same error for me to XAgent Llama model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants