[releases/v0.18.0][Platform][BugFix] Guard forced tool choice with empty content (#8400)
### What this PR does / why we need it? This backports the forced-tool-choice `content=None` guard to the `releases/v0.18.0` compatibility layer. Upstream vLLM still has forced named tool-choice branches that assert `content is not None` after reasoning extraction. Some reasoning parsers can legally consume the full output and return `(reasoning, None)`, which makes the assert reachable and can surface as a server-side failure. This PR follows the same compatibility-patch pattern used by: - `7314bbe2` fix(platform): reimplement MiniMax usage accounting patch (#7835) - `f83cb0e6` [Bugfix][Platform] Fix GLM47 tool-call finish backfill (#7710) The patch is intentionally narrow: - normalize `content=None` to `""` only for forced named tool choice - patch both chat-completions and responses parser entry points - keep the rest of upstream behavior unchanged Upstream tracking: - issue: vllm-project/vllm#40147 - PR: vllm-project/vllm#40148 ### Does this PR introduce _any_ user-facing change? Yes. Forced named tool choice becomes robust when the reasoning parser returns no post-reasoning content, avoiding an internal assertion failure and emitting an empty-argument function call instead. ### How was this patch tested? Unit tests: ```bash pytest -sv tests/ut/patch/platform/test_patch_tool_choice_none_content.py \ tests/ut/patch/platform/test_patch_glm_tool_call_parser.py \ tests/ut/patch/platform/test_patch_minimax_usage_accounting.py ``` Result: 22 passed. --------- Signed-off-by: QwertyJack <7554089+QwertyJack@users.noreply.github.com> Co-authored-by: QwertyJack <7554089+QwertyJack@users.noreply.github.com>
This commit is contained in:
@@ -238,6 +238,26 @@
|
||||
# finish-backfill fix are present in the runtime vLLM version used by
|
||||
# vllm-ascend.
|
||||
#
|
||||
# ** 11. File: platform/patch_tool_choice_none_content.py**
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# 1. `vllm.entrypoints.openai.engine.serving.OpenAIServing`
|
||||
# `vllm.parser.abstract_parser.DelegatingParser`
|
||||
# Why:
|
||||
# Some reasoning parsers can consume the full model output and return
|
||||
# `content=None`. On the release runtime, forced named tool choice still
|
||||
# asserts that content is present before constructing a function call,
|
||||
# which can surface as a server-side failure instead of an empty-argument
|
||||
# tool call.
|
||||
# How:
|
||||
# Monkey-patch the forced-tool-choice parsing entry points to normalize
|
||||
# `content=None` to `""` before delegating back to the original upstream
|
||||
# implementations.
|
||||
# Related PR (if no, explain why):
|
||||
# https://github.com/vllm-project/vllm/pull/40148
|
||||
# Future Plan:
|
||||
# Remove this patch once the upstream forced-tool-choice fix is included
|
||||
# in the runtime vLLM version used by vllm-ascend.
|
||||
#
|
||||
# * Worker Patch:
|
||||
# ===============
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user