Skip to content

[frontend] enhance tool_calls type check #16882

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

Merged

Conversation

reidliu41
Copy link
Contributor

@reidliu41 reidliu41 commented Apr 20, 2025

FIX #16678 (link existing issues this PR will resolve)

Based on the description with tool_calls is None, it can reproduce:

client:
python examples/online_serving/openai_chat_completion_client_with_tools.py

    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'object': 'error', 'message': "'NoneType' object is not iterable", 'type': 'BadRequestError', 'param': None, 'code': 400}


server:
INFO 04-20 07:58:28 [async_llm.py:239] Added request chatcmpl-c45e0e16c6694176a2ca86df9926de39.
ERROR 04-20 07:58:29 [serving_chat.py:200] Error in preprocessing prompt inputs
ERROR 04-20 07:58:29 [serving_chat.py:200] Traceback (most recent call last):
ERROR 04-20 07:58:29 [serving_chat.py:200]   File "/home/user/vllm/vllm/entrypoints/openai/serving_chat.py", line 183, in create_chat_completion
ERROR 04-20 07:58:29 [serving_chat.py:200]     ) = await self._preprocess_chat(
ERROR 04-20 07:58:29 [serving_chat.py:200]         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR 04-20 07:58:29 [serving_chat.py:200]   File "/home/user/vllm/vllm/entrypoints/openai/serving_engine.py", line 403, in _preprocess_chat
ERROR 04-20 07:58:29 [serving_chat.py:200]     conversation, mm_data_future = parse_chat_messages_futures(
ERROR 04-20 07:58:29 [serving_chat.py:200]                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR 04-20 07:58:29 [serving_chat.py:200]   File "/home/user/vllm/vllm/entrypoints/chat_utils.py", line 1158, in parse_chat_messages_futures
ERROR 04-20 07:58:29 [serving_chat.py:200]     sub_messages = _parse_chat_message_content(
ERROR 04-20 07:58:29 [serving_chat.py:200]                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR 04-20 07:58:29 [serving_chat.py:200]   File "/home/user/vllm/vllm/entrypoints/chat_utils.py", line 1098, in _parse_chat_message_content
ERROR 04-20 07:58:29 [serving_chat.py:200]     result_msg["tool_calls"] = list(parsed_msg["tool_calls"])
ERROR 04-20 07:58:29 [serving_chat.py:200]                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR 04-20 07:58:29 [serving_chat.py:200] TypeError: 'NoneType' object is not iterable

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added the frontend label Apr 20, 2025
@reidliu41
Copy link
Contributor Author

@DarkLight1337 could you pls also help to take a look this?

Signed-off-by: reidliu41 <[email protected]>
@DarkLight1337
Copy link
Member

Can you add a comment explaining that this is just for compatibility purposes? Since it's technically unnecessary if downstream compiles with OpenAI spec

Signed-off-by: reidliu41 <[email protected]>
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) April 22, 2025 13:22
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Apr 22, 2025
@DarkLight1337 DarkLight1337 merged commit f344107 into vllm-project:main Apr 22, 2025
46 of 48 checks passed
frieda-huang pushed a commit to frieda-huang/vllm that referenced this pull request Apr 23, 2025
Signed-off-by: reidliu41 <[email protected]>
Co-authored-by: reidliu41 <[email protected]>
Signed-off-by: Frieda (Jingying) Huang <[email protected]>
jikunshang pushed a commit to jikunshang/vllm that referenced this pull request Apr 29, 2025
lk-chen pushed a commit to lk-chen/vllm that referenced this pull request Apr 29, 2025
adobrzyn pushed a commit to HabanaAI/vllm-fork that referenced this pull request Apr 30, 2025
Signed-off-by: reidliu41 <[email protected]>
Co-authored-by: reidliu41 <[email protected]>
Signed-off-by: Agata Dobrzyniewicz <[email protected]>
RichardoMrMu pushed a commit to RichardoMrMu/vllm that referenced this pull request May 12, 2025
Signed-off-by: reidliu41 <[email protected]>
Co-authored-by: reidliu41 <[email protected]>
Signed-off-by: Mu Huai <[email protected]>
minpeter pushed a commit to minpeter/vllm that referenced this pull request Jun 24, 2025
Signed-off-by: reidliu41 <[email protected]>
Co-authored-by: reidliu41 <[email protected]>
Signed-off-by: minpeter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: tool_calls and None types.
2 participants