mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
When I call the function call of qwen-qwq, I get an Error: list index out of range #62
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @YinSonglin1997 on GitHub (Mar 10, 2025).
Self Checks
Dify version
0.15.3
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I executed the following command in the background:
python -m vllm.entrypoints.openai.api_server --model /mnt2/ysl/QwQ-32B --tensor_parallel_size 4 --enable-auto-tool-choice --tool-call-parser hermes --trust-remote-code --max-model-len 131072 --host 0.0.0.0 --port 8000However, the agent application cannot call the tool, and an error "list index out of range" is reported. How can I solve this problem?
✔️ Expected Behavior
Correct call tool
❌ Actual Behavior
Unable to call tool
@dosubot[bot] commented on GitHub (Mar 10, 2025):
The "list index out of range" error you're encountering when calling a tool in the Dify platform can occur due to several reasons related to how tool parameters and responses are handled. Here are some potential causes and solutions:
Tool Parameters Handling: Ensure that the tool parameters are correctly formatted and match the expected number of parameters. If the tool expects a specific number of parameters and the provided parameters do not match, it could lead to accessing an index that does not exist. Check the conversion of
tool_parametersfrom a string to a dictionary and ensure that the parameters list is not empty when accessed [1].Tool Response Handling: Verify that the tool response list contains the expected elements. If the tool response list is empty or does not contain the expected message types, iterating over it or accessing specific indices could lead to an index error. Ensure that the tool response is correctly populated before processing [1].
Binary and Text Extraction: Check the extraction of binary and text from the tool response. If the tool response list is expected to have certain elements and it doesn't, accessing specific indices could lead to an index error. Make sure that the tool response contains the necessary metadata and message types [1].
Review these areas in your code to ensure that the tool parameters and responses are correctly handled. Adjust the logic to prevent accessing indices that may not exist, and ensure that all expected data is present before processing.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
@zhangao0086 commented on GitHub (Mar 10, 2025):
What does the list api of vllm return? Additionally, can it be successfully called in the terminal, for example, using curl?
@YinSonglin1997 commented on GitHub (Mar 10, 2025):
Can be called correctly, but also return the tool parameters. I wonder if there is a problem in the dify background when parsing Function.
@zhangao0086 commented on GitHub (Mar 10, 2025):
You can pinpoint the root cause of an error by examining the logs of the API container. Here's an example command to view these logs:
It's possible that there are some incompatibilities in the implementation of
openai_api_compatible:https://github.com/langgenius/dify/blob/0.15.3/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py#L291
@chiehw commented on GitHub (Apr 24, 2025):
I tried to fix this problem and it worked fine on my model (Qwen2.5-32B)
@YinSonglin1997 commented on GitHub (Apr 24, 2025):
Have you upgraded to the vllm version? I upgraded vllm and added
--tool-call-paraser@chiehw commented on GitHub (Apr 24, 2025):
It has nothing to do with vllm. This error is caused by dify.