Repository navigation
[Bugfix][Tool Parser] Stream all tool calls completed in one delta (ernie45, jamba, granite-20b-fc) - #65784
Conversation
…rnie45, jamba, granite-20b-fc) When a whole tool-call message arrives in a single streamed delta (async scheduling or stream_interval > 1), the ernie45, jamba and granite-20b-fc parsers drop or mangle the calls: ernie45 keeps only the first complete block, jamba's "starting a new tool" branch returns without emitting, and granite-20b-fc skips whole calls, streams name-less argument fragments, or strands the last call's arguments. Fixes vllm-project#48294. Revives vllm-project#48295 (ernie45, @abhay-codes07), validated by @ErenAta16 in July, and the granite-20b-fc direction from vllm-project#47955, reviewed by @smiyamoto3; both PRs are unmerged and inactive. This change generalizes them: the jamba and granite-20b-fc "new tool" branch now emits every newly completed call in full instead of deferring to later deltas, and the name branch co-sends complete arguments so no call depends on another delta to finish. ernie45 now returns None instead of empty DeltaMessages for separator and trailing deltas, and keeps text between tool calls out of content, matching the non-streaming path. Co-authored-by: GLM-5.3 <noreply@z.ai> Signed-off-by: xiaohaifeng1999 <1491035393@qq.com>
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment Once the PR is approved or has the If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. Agent GuidelinesIMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban. 🚀 |
Overview
When a tool-call message arrives in one streamed delta, ernie45 emits only the first call, while jamba and granite-20b-fc emit none or mangle the calls. This change makes each parser emit every call completed by a delta. Fixes #48294.
Claims
stream_interval > 1) instead of dropping or mangling calls.Noneinstead of emptyDeltaMessages.Validation
Measured on
0db3734d51, the branch point of this change. Upstream main has since advanced 64 commits; none touch these six files.Through the in-tree streaming harness (
run_tool_extraction_streaming):New regression tests: 19 cases, 16 fail on that base and all pass with this change. The other 3 guard the new semantics (no empty argument deltas, no empty trailing
DeltaMessage) and pass before and after.The xfail is a pre-existing granite surrounding-text test, unchanged by this PR. Locally I also set
HF_ENDPOINT=https://hf-mirror.com, since huggingface.co is unreachable from my network.No model-quality eval: the model's generated tokens and the non-streaming extraction are unchanged. This change only affects how already-complete calls are chunked in streaming, which the suites above cover.
Details
Root cause, per parser:
Nonewithout emitting anything.current_tool_idto the last index, skipping whole calls, and its flush emitted argument fragments without a name.Fix:
Nonefor deltas with nothing to send.Prior work: #48295 is the only open PR referencing #48294. It has been inactive since July (stale, needs rebase, no author response); we are posting a heads-up comment there as this PR opens.
gigachat3 shows the same family of bug but is out of scope here; #51702 covers that parser.
Tradeoff: a coarse delta now produces one chunk carrying several complete calls. That matches the non-streaming path and the shape both prior PRs proposed. Fine-grained streaming is unchanged; the existing tests all pass.
The fix and tests were written with AI assistance (GLM). I reviewed every changed line across two review rounds and verified the runs and artifacts above.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Per-parser fixes stay in the parsers' own files per
vllm/tool_parsers/AGENTS.md; no engine or interface changes.Testing and Validation: 19 new streaming tests; 16 fail on the base commit, all pass with the change; suites run against real tokenizers where available.
Code Quality and Style: ruff check and format clean; comments limited to non-obvious decisions.
Pull Request Contents: Root cause, evidence, prior-work credit, scope, and tradeoffs included above.