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

部署后测试提问‘你好’出现错误 #400

Open
xxx1099836595 opened this issue Apr 30, 2024 · 1 comment
Open

部署后测试提问‘你好’出现错误 #400

xxx1099836595 opened this issue Apr 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@xxx1099836595
Copy link

Issue Description / 问题描述

按照文档正常配置openai 秘钥代理地址,ui websocket 都正常,

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

Traceback (most recent call last): File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgentServer/server.py", line 104, in interact task_handler.outer_loop() File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/workflow/task_handler.py", line 82, in outer_loop self.plan_agent.initial_plan_generation( File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/workflow/plan_exec.py", line 164, in initial_plan_generation new_message , _ = agent.parse( File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/agent/plan_generate_agent/agent.py", line 49, in parse return self.generate( File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/agent/base_agent.py", line 121, in generate response = objgenerator.chatcompletion( File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 289, in wrapped_f return self(f, *args, **kw) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 379, in __call__ do = self.iter(retry_state=retry_state) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 314, in iter return fut.result() File "/root/miniconda3/envs/xagent/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.__get_result() File "/root/miniconda3/envs/xagent/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 382, in __call__ result = fn(*args, **kwargs) File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/ai_functions/request/obj_generator.py", line 66, in chatcompletion raise e File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/ai_functions/request/obj_generator.py", line 60, in chatcompletion response = self._get_chatcompletion_request_func(request_type)(**kwargs) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 289, in wrapped_f return self(f, *args, **kw) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 379, in __call__ do = self.iter(retry_state=retry_state) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 314, in iter return fut.result() File "/root/miniconda3/envs/xagent/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.__get_result() File "/root/miniconda3/envs/xagent/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/tenacity/__init__.py", line 382, in __call__ result = fn(*args, **kwargs) File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/ai_functions/request/openai.py", line 209, in chatcompletion_request raise e File "/mnt/fileserver/chat_x/xagentdemo/XAgent/XAgent/ai_functions/request/openai.py", line 177, in chatcompletion_request completions = client.chat.completions.create(**chatcompletion_kwargs) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/openai/_utils/_utils.py", line 277, in wrapper return func(*args, **kwargs) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 579, in create return self._post( File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/openai/_base_client.py", line 1232, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/openai/_base_client.py", line 921, in request return self._request( File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/openai/_base_client.py", line 997, in _request return self._retry_request( File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/openai/_base_client.py", line 1045, in _retry_request return self._request( File "/root/miniconda3/envs/xagent/lib/python3.10/site-packages/openai/_base_client.py", line 1012, in _request raise self._make_status_error_from_response(err.response) from None openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for function 'subtask_split_operation': In context=('properties', 'subtasks'), array schema missing items (request id: 202404301152115450544920156385)", 'type': 'invalid_request_error', 'param': '', 'code': None}}
企业微信截图_20240430115533
企业微信截图_20240430115649

Additional Notes / 其他备注

centos7
docker-compose 部署

@xxx1099836595 xxx1099836595 added the bug Something isn't working label Apr 30, 2024
@xxx1099836595
Copy link
Author

经过我测试发现

openai functions 和 function_call 将要废弃,指定function_call,返回然是messages响应.
{'model': 'gpt-3.5-turbo-16k', 'messages': [{'role': 'system', 'content': 'You are an efficient plan-generation agent, your task is to decompose a query into several subtasks that describe must achieved goals for the query.\n--- Background Information ---\nPLAN AND SUBTASK:\nA plan has a tree manner of subtasks: task 1 contatins subtasks task 1.1, task 1.2, task 1.3, ... and task 1.2 contains subtasks 1.2.1, 1.2.2, ...\n\nA subtask-structure has the following json component:\n{\n"subtask name": string, name of the subtask\n"goal.goal": string, the main purpose of the subtask, and what will you do to reach this goal?\n"goal.criticism": string, what potential problems may the current subtask and goal have?\n"milestones": list[string]. what milestones should be achieved to ensure the subtask is done? Make it detailed and specific.\n}\nSUBTASK HANDLE:\nA task-handling agent will handle all the subtasks as the inorder-traversal. For example:\n1. it will handle subtask 1 first.\n2. if solved, handle subtask 2. If failed, split subtask 1 as subtask 1.1 1.2 1.3... Then handle subtask 1.1 1.2 1.3...\n3. Handle subtasks recurrsively, until all subtasks are soloved. Do not make the task queue too complex, make it efficiently solve the original task.\n4. It is powered by a state-of-the-art LLM, so it can handle many subtasks without using external tools or execute codes.\n\nRESOURCES:\n1. Internet access for searches and information gathering, search engine and web browsing.\n2. A FileSystemEnv to read and write files (txt, code, markdown, latex...)\n3. A python notebook to execute python code. Always follow python coding rules.\n4. A ShellEnv to execute bash or zsh command to further achieve complex goals. \n--- Task Description ---\nGenerate the plan for query with operation SUBTASK_SPLIT, make sure all must reach goals are included in the plan.\n\n*** Important Notice ***\n- Always make feasible and efficient plans that can lead to successful task solving. Never create new subtasks that similar or same as the existing subtasks.\n- For subtasks with similar goals, try to do them together in one subtask with a list of subgoals, rather than split them into multiple subtasks.\n- Do not waste time on making irrelevant or unnecessary plans.\n- The task handler is powered by sota LLM, which can directly answer many questions. So make sure your plan can fully utilize its ability and reduce the complexity of the subtasks tree.\n- You can plan multiple subtasks if you want.\n- Minimize the number of subtasks, but make sure all must reach goals are included in the plan.\n'}, {'role': 'user', 'content': 'This is not the first time you are handling the task, so you should give a initial plan. Here is the query:\n"""\n{\n "name": "act as Assistant",\n "goal": "帮我生成一些数字",\n "prior_plan_criticsim": "",\n "milestones": [],\n "exceute_status": "TODO"\n}\n"""\nYou will use operation SUBTASK_SPLIT to split the query into 2-4 subtasks and then commit.'}], 'functions': [{'name': 'subtask_split_operation', 'description': 'further split the target subtask into subtasks. You can only split a status==FAIL task', 'parameters': {'type': 'object', 'properties': {'target_subtask_id': {'type': 'string', 'description': "Which subtask do you want to modify. This must be a inter split by '.', like '1.2' '2.3.3' or '4'. You must ensure this subtask exists and is a FAIL task"}, 'subtasks': {'type': 'array', 'description': 'Max 3 items, min 1 items. Array of the splited subtasks, length of 1-3', 'items': {'type': 'object', 'properties': {'subtask name': {'type': 'string'}, 'goal': {'type': 'object', 'properties': {'goal': {'type': 'string', 'description': 'the main purpose of what the sub-task should handle, and what will you do(tool calls) to reach this goal'}, 'criticism': {'type': 'string', 'description': 'What problems may the current subtask and goal have?'}}}, 'milestones': {'type': 'array', 'description': 'How to automatically check the subtask is done? The subtasks after this subtask will consider all the milestones are done.', 'items': {'type': 'string'}}}, 'required': ['subtask name', 'goal', 'milestones']}}, 'thought': {'description': 'Why you choose this operation, and what you want to do next?', 'type': 'string'}}, 'required': ['target_subtask_id', 'subtasks', 'thought']}}], 'function_call': {'name': 'subtask_split_operation'}}
使用 openai

tools
tools_call

不会出现这种情况

{ 'model': 'gpt-3.5-turbo-16k', 'messages': [ { 'role': 'system', 'content': 'You are an efficient plan-generation agent, your task is to decompose a query into several subtasks that describe must achieved goals for the query.\n--- Background Information ---\nPLAN AND SUBTASK:\nA plan has a tree manner of subtasks: task 1 contatins subtasks task 1.1, task 1.2, task 1.3, ... and task 1.2 contains subtasks 1.2.1, 1.2.2, ...\n\nA subtask-structure has the following json component:\n{\n"subtask name": string, name of the subtask\n"goal.goal": string, the main purpose of the subtask, and what will you do to reach this goal?\n"goal.criticism": string, what potential problems may the current subtask and goal have?\n"milestones": list[string]. what milestones should be achieved to ensure the subtask is done? Make it detailed and specific.\n}\nSUBTASK HANDLE:\nA task-handling agent will handle all the subtasks as the inorder-traversal. For example:\n1. it will handle subtask 1 first.\n2. if solved, handle subtask 2. If failed, split subtask 1 as subtask 1.1 1.2 1.3... Then handle subtask 1.1 1.2 1.3...\n3. Handle subtasks recurrsively, until all subtasks are soloved. Do not make the task queue too complex, make it efficiently solve the original task.\n4. It is powered by a state-of-the-art LLM, so it can handle many subtasks without using external tools or execute codes.\n\nRESOURCES:\n1. Internet access for searches and information gathering, search engine and web browsing.\n2. A FileSystemEnv to read and write files (txt, code, markdown, latex...)\n3. A python notebook to execute python code. Always follow python coding rules.\n4. A ShellEnv to execute bash or zsh command to further achieve complex goals. \n--- Task Description ---\nGenerate the plan for query with operation SUBTASK_SPLIT, make sure all must reach goals are included in the plan.\n\n*** Important Notice ***\n- Always make feasible and efficient plans that can lead to successful task solving. Never create new subtasks that similar or same as the existing subtasks.\n- For subtasks with similar goals, try to do them together in one subtask with a list of subgoals, rather than split them into multiple subtasks.\n- Do not waste time on making irrelevant or unnecessary plans.\n- The task handler is powered by sota LLM, which can directly answer many questions. So make sure your plan can fully utilize its ability and reduce the complexity of the subtasks tree.\n- You can plan multiple subtasks if you want.\n- Minimize the number of subtasks, but make sure all must reach goals are included in the plan.\n' }, { 'role': 'user', 'content': 'This is not the first time you are handling the task, so you should give a initial plan. Here is the query:\n"""\n{\n "name": "act as Assistant",\n "goal": "tel me 1+1",\n "prior_plan_criticsim": "",\n "milestones": [],\n "exceute_status": "TODO"\n}\n"""\nYou will use operation SUBTASK_SPLIT to split the query into 2-4 subtasks and then commit.'} ], 'tools': [ { "type": "function", "function": { 'name': 'subtask_split_operation', 'description': 'further split the target subtask into subtasks. You can only split a status==FAIL task', 'parameters': { 'type': 'object', 'properties': { 'target_subtask_id': { 'type': 'string', 'description': "Which subtask do you want to modify. This must be a inter split by '.', like '1.2' '2.3.3' or '4'. You must ensure this subtask exists and is a FAIL task" }, 'subtasks': { 'type': 'array', 'description': 'Max 3 items, min 1 items. Array of the splited subtasks, length of 1-3', 'items': { 'type': 'object', 'properties': { 'subtask name': { 'type': 'string' }, 'goal': { 'type': 'object', 'properties': { 'goal': { 'type': 'string', 'description': 'the main purpose of what the sub-task should handle, and what will you do(tool calls) to reach this goal' }, 'criticism': { 'type': 'string', 'description': 'What problems may the current subtask and goal have?' } } }, 'milestones': { 'type': 'array', 'description': 'How to automatically check the subtask is done? The subtasks after this subtask will consider all the milestones are done.', 'items': {'type': 'string'} } }, 'required': ['subtask name', 'goal', 'milestones'] } }, 'thought': { 'description': 'Why you choose this operation, and what you want to do next?', 'type': 'string' } }, 'required': ['target_subtask_id', 'subtasks', 'thought'] } } } ], 'tool_choice': {"type": "function", "function": {"name": "subtask_split_operation"}} }

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

1 participant