GPTAPI类型模型,fastapi返回消息报错:缺少必要字段“input”
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- fastapi, javascript, python
調査の方向性
models.py と FastAPI サービスで使用されている GPTAPI リクエストパスから始め、次に、報告にある VLLM_BASE_URL、VLLM_API_KEY、VLLM_MODEL_NAME の設定で問題を再現します。生成されたリクエストを、FastAPI のバリデーションエラーおよび vLLM の chat-completions エンドポイントと比較します。フロントエンドの検索が、報告された 400 レスポンスなしで完了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
症状描述
在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显示名,实际模型和之前一样)
真是令人费解!
是否影响使用
由于这个问题而无法使用。
- 主要言語
- JavaScript
- スター
- 7k
- フォーク
- 684
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
InternLM/MindSearch のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
InternLM/MindSearch#326 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
InternLM/MindSearch#315 ·
-
问答只回复一次,没有完整推理搜索回复オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
InternLM/MindSearch#312 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
InternLM/MindSearch#311 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
InternLM/MindSearch#310 ·
InternLM/MindSearch の issue をすべて見る
似ている issue
-
area/frontend good first issue topic/intents
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
aws-samples/sample-collaborative-ai-dlc#1049 ·
メンテナーはふだん 1 日以内に返信
-
cvss-severity:high devguard l3montree-cybersecurity/.../devguard-documentation pkg:oci/devguard-documen...ch=amd64&tag=main-amd64 risk:low state:open
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
l3montree-dev/devguard-documentation#396 · コメント 1 件 ·
-
enhancement status/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
WhiteBr1ck/agy-powertools#361 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
avniproject/avni-webapp#1861 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
avniproject/avni-client#2268 ·