GPTAPI类型模型,fastapi返回消息报错:缺少必要字段“input”
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- fastapi, javascript, python
Hướng nghiên cứu
Bắt đầu với models.py và đường dẫn yêu cầu GPTAPI được dịch vụ FastAPI sử dụng, sau đó tái hiện sự cố với các thiết lập VLLM_BASE_URL, VLLM_API_KEY và VLLM_MODEL_NAME trong báo cáo. So sánh yêu cầu được tạo với lỗi xác thực FastAPI và endpoint chat-completions của vLLM. Hoàn tất khi một tìm kiếm trên frontend hoàn thành mà không có phản hồi 400 được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
症状描述
在frontend中正常输入搜索关键词并触发搜索后,卡住不动。fastapi报错:
{"object":"error","message":"[{'type': 'missing', 'loc': ('body', 'messages'), 'msg': 'Field required', 'input': {'model': 'qwen2-vl-7b-instruct', 'input': {'messages': [{'role': 'system', 'content': 'The current date is 2024-12-04.'}, {'role': 'system', 'content': \"## Character Profile\\nYou are a programmer capable of Python programming in a Jupyter environment. You can utilize the provided API to construct a Web Search Graph, ultimately generating and executing code.\\n\\n## API Description\\n\\nBelow is the API documentation for the WebSearchGraph class, including detailed attribute descriptions:\\n\\n### Class: WebSearchGraph\\n\\nThis class manages nodes and edges of a web search graph and conducts searches via a web proxy.\\n\\n#### Initialization Method\\n\\nInitializes an instance of WebSearchGraph.\\n\\n**Attributes:**\\n\\n- nodes (Dict[str, Dict[str, str]]): A dictionary storing all nodes in the graph. Each node is indexed by its name and contains content, type, and other related information.\\n- adjacency_list (Dict[str, List[str]]): An adjacency list storing the connections between all nodes in the graph. Each node is indexed by its name and contains a list of adjacent node names.\\n\\n#### Method: add_root_node\\n\\nAdds the initial question as the root node.\\n**Parameters:**\\n\\n- node_content (str): The user's question.\\n- node_name (str, optional): The node name, default is 'root'.\\n\\n#### Method: add_node\\n\\nAdds a sub-question node and returns search results.\\n**Parameters:**\\n\\n- node_name (str): The node name.\\n- node_content (str): The sub-question content.\\n\\n**Returns:**\\n\\n- str: Returns the search results.\\n\\n#### Method: add_response_node\\n\\nAdds a response node when the current information satisfies the question's requirements.\\n\\n**Parameters:**\\n\\n- node_name (str, optional): The node name, default is 'response'.\\n\\n#### Method: add_edge\\n\\nAdds an edge.\\n\\n**Parameters:**\\n\\n- start_node (str): The starting node name.\\n- end_node (str): The ending node name.\\n\\n#### Method: reset\\n\\nResets nodes and edges.\\n\\n#### Method: node\\n\\nGet node information.\\n\\npython\\ndef node(self, node_name: str) -> str\\n\\n**Parameters:**\\n\\n- node_name (str): The node name.\\n\\n**Returns:**\\n\\n- str: Returns a dictionary containing the node's information, including content, type, thought process (if any), and list of predecessor nodes.\\n\\n## Task Description\\nBy breaking down a question into sub-questions that can be answered through searches (unrelated questions can be searched concurrently), each search query should be a single question focusing on a specific person, event, object, specific time point, location, or knowledge point. It should not be a compound question (e.g., a time period). Step by step, build the search graph to finally answer the question.\\n\\n## Considerations\\n\\n1. Each search node's content must be a single question; do not include multiple questions (e.g., do not ask multiple knowledge points or compare and filter multiple things simultaneously, like asking for differences between A, B, and C, or price ranges -> query each separately).\\n2. Do not fabricate search results; wait for the code to return results.\\n3. Do not repeat the same question; continue asking based on existing questions.\\n4. When adding a response node, add it separately; do not add a response node and other nodes simultaneously.\\n5. In a single output, do not include multiple code blocks; only one code block per output.\\n6. Each code block should be placed within a code block marker, and after generating the code, add an <|action_end|> tag as shown below:\\n <|action_start|><|interpreter|>\\n ```python\\n # Your code block (Note that the 'Get new added node information' logic must be added at the end of the code block, such as 'graph.node('...')')\\n ```<|action_end|>\\n7. The final response should add a response node with node_name 'response', and no other nodes should be added.\\n\", 'name': 'interpreter'}, {'role': 'user', 'content': '如果想要更丝滑的体验,请在本地搭建-Mi'}]}, 'parameters': {'top_p': 0.9, 'temperature': 0.2, 'stream': True, 'max_tokens': 4096, 'stop': ['<|im_end|>'], 'repetition_penalty': 1.1, 'result_format': 'message'}}}, {'type': 'extra_forbidden', 'loc': ('body', 'input'), 'msg': 'Extra inputs are not permitted', 'input': {'messages': [{'role': 'system', 'content': 'The current date is 2024-12-04.'}, {'role': 'system', 'content': \"## Character Profile\\nYou are a programmer capable of Python programming in a Jupyter environment. You can utilize the provided API to construct a Web Search Graph, ultimately generating and executing code.\\n\\n## API Description\\n\\nBelow is the API documentation for the WebSearchGraph class, including detailed attribute descriptions:\\n\\n### Class: WebSearchGraph\\n\\nThis class manages nodes and edges of a web search graph and conducts searches via a web proxy.\\n\\n#### Initialization Method\\n\\nInitializes an instance of WebSearchGraph.\\n\\n**Attributes:**\\n\\n- nodes (Dict[str, Dict[str, str]]): A dictionary storing all nodes in the graph. Each node is indexed by its name and contains content, type, and other related information.\\n- adjacency_list (Dict[str, List[str]]): An adjacency list storing the connections between all nodes in the graph. Each node is indexed by its name and contains a list of adjacent node names.\\n\\n#### Method: add_root_node\\n\\nAdds the initial question as the root node.\\n**Parameters:**\\n\\n- node_content (str): The user's question.\\n- node_name (str, optional): The node name, default is 'root'.\\n\\n#### Method: add_node\\n\\nAdds a sub-question node and returns search results.\\n**Parameters:**\\n\\n- node_name (str): The node name.\\n- node_content (str): The sub-question content.\\n\\n**Returns:**\\n\\n- str: Returns the search results.\\n\\n#### Method: add_response_node\\n\\nAdds a response node when the current information satisfies the question's requirements.\\n\\n**Parameters:**\\n\\n- node_name (str, optional): The node name, default is 'response'.\\n\\n#### Method: add_edge\\n\\nAdds an edge.\\n\\n**Parameters:**\\n\\n- start_node (str): The starting node name.\\n- end_node (str): The ending node name.\\n\\n#### Method: reset\\n\\nResets nodes and edges.\\n\\n#### Method: node\\n\\nGet node information.\\n\\npython\\ndef node(self, node_name: str) -> str\\n\\n**Parameters:**\\n\\n- node_name (str): The node name.\\n\\n**Returns:**\\n\\n- str: Returns a dictionary containing the node's information, including content, type, thought process (if any), and list of predecessor nodes.\\n\\n## Task Description\\nBy breaking down a question into sub-questions that can be answered through searches (unrelated questions can be searched concurrently), each search query should be a single question focusing on a specific person, event, object, specific time point, location, or knowledge point. It should not be a compound question (e.g., a time period). Step by step, build the search graph to finally answer the question.\\n\\n## Considerations\\n\\n1. Each search node's content must be a single question; do not include multiple questions (e.g., do not ask multiple knowledge points or compare and filter multiple things simultaneously, like asking for differences between A, B, and C, or price ranges -> query each separately).\\n2. Do not fabricate search results; wait for the code to return results.\\n3. Do not repeat the same question; continue asking based on existing questions.\\n4. When adding a response node, add it separately; do not add a response node and other nodes simultaneously.\\n5. In a single output, do not include multiple code blocks; only one code block per output.\\n6. Each code block should be placed within a code block marker, and after generating the code, add an <|action_end|> tag as shown below:\\n <|action_start|><|interpreter|>\\n ```python\\n # Your code block (Note that the 'Get new added node information' logic must be added at the end of the code block, such as 'graph.node('...')')\\n ```<|action_end|>\\n7. The final response should add a response node with node_name 'response', and no other nodes should be added.\\n\", 'name': 'interpreter'}, {'role': 'user', 'content': '如果想要更丝滑的体验,请在本地搭建-Mi'}]}}, {'type': 'extra_forbidden', 'loc': ('body', 'parameters'), 'msg': 'Extra inputs are not permitted', 'input': {'top_p': 0.9, 'temperature': 0.2, 'stream': True, 'max_tokens': 4096, 'stop': ['<|im_end|>'], 'repetition_penalty': 1.1, 'result_format': 'message'}}]","type":"BadRequestError","param":null,"code":400}
可以从信息中发现request字典多了一层外面的模型名,应该是里面那层input。
vLLM后端报错:
"POST /v1/chat/completions HTTP/1.1" 400 BAD REQUEST
如何复现
(models.py要加一行load_dotenv,否则还加载不出来api和key)
设置以下环境变量:
VLLM_BASE_URL="http://192.168.1.9:8008/v1"
VLLM_API_KEY=[MY_API_KEY]
VLLM_MODEL_NAME="qwen2-vl-7b-instruct"
使用以下模型设置:
vllm = dict(
type=GPTAPI,
model_type=os.environ.get("VLLM_MODEL_NAME"),
key=os.environ.get("VLLM_API_KEY"),
api_base= f"{os.environ.get("VLLM_BASE_URL")}/chat/completions",
meta_template=[
dict(role="system", api_role="system"),
dict(role="user", api_role="user"),
dict(role="assistant", api_role="assistant"),
dict(role="environment", api_role="system"),
],
top_p=0.9,
# top_k=1,
temperature=0.2,
max_new_tokens=4096,
repetition_penalty=1.1,
stop_words=["<|im_end|>"],
)
启动fastapi
python -m mindsearch.app --lang en --model_format vllm --search_engine GoogleSearch --asy
在前端正常输入搜索就会报错。
但是把模型名字改成gpt-smart,就能输出一部分内容了,虽然也是gibberish,但是至少输出了。(vllm显示名,实际模型和之前一样)
真是令人费解!
是否影响使用
由于这个问题而无法使用。
- Ngôn ngữ chính
- JavaScript
- Star
- 7k
- Fork
- 684
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InternLM/MindSearch
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
InternLM/MindSearch#326 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
InternLM/MindSearch#315 ·
-
问答只回复一次,没有完整推理搜索回复Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
InternLM/MindSearch#312 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
InternLM/MindSearch#311 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
InternLM/MindSearch#310 ·
Tất cả issue của InternLM/MindSearch
Issue tương tự
-
area/frontend good first issue topic/intents
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
aws-samples/sample-collaborative-ai-dlc#1049 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cvss-severity:high devguard l3montree-cybersecurity/.../devguard-documentation pkg:oci/devguard-documen...ch=amd64&tag=main-amd64 risk:low state:open
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
l3montree-dev/devguard-documentation#396 · 1 bình luận ·
-
enhancement status/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
WhiteBr1ck/agy-powertools#361 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
avniproject/avni-webapp#1861 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
avniproject/avni-client#2268 ·