[Bugfix] Fix GLM zero-arg streaming tool names#41654
Open
joninco wants to merge 2 commits into
Open
Conversation
Treat a completed GLM tool-call region with no newline or arg tags as a zero-argument tool call name. This lets streaming emit the function name and {} arguments for calls such as mcp__gmail-cleanup__list_filters.
Strengthen the GLM-4.7 streaming regression tests to assert the emitted name and argument fragments instead of only checking parser state allocation.
Assisted-by: OpenAI Codex
Signed-off-by: jon <joninco@bullpoint.org>
Contributor
|
Hi @joninco, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the GLM4 tool parser to support zero-argument tool calls by allowing the tool name to be extracted from a complete tool-call region even when delimiters are absent. It introduces an 'is_complete' parameter to the name extraction logic and refactors the associated tests to use helper functions for streaming chunks, including a new test case for MCP-style tool names. I have no feedback to provide.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<arg_key>as a zero-argument tool call name.{}argument fragments.mcp__gmail-cleanup__list_filters.Why this is not duplicating an existing PR
I checked open PRs for the related areas before submitting. PR #39615 fixes the generic
serving.pyfinish-flush path that can blank arguments when all args arrive in one delta, but it does not change the GLM parser. This PR is narrower: it fixes GLM parser name extraction for completed zero-argument streaming tool calls.Related but different open PRs found:
Human review / AI assistance
I reviewed the 5 logical code lines modified in the parser. AI assistance was used to prepare the branch and tests.
Tests
pre-commit run --files vllm/tool_parsers/glm4_moe_tool_parser.py tests/tool_parsers/test_glm47_moe_tool_parser.py.venv/bin/ruff check vllm/tool_parsers/glm4_moe_tool_parser.py tests/tool_parsers/test_glm47_moe_tool_parser.py.venv/bin/ruff format --check vllm/tool_parsers/glm4_moe_tool_parser.py tests/tool_parsers/test_glm47_moe_tool_parser.py.venv/bin/python -m py_compile vllm/tool_parsers/glm4_moe_tool_parser.py tests/tool_parsers/test_glm47_moe_tool_parser.pyget_current_dateandmcp__gmail-cleanup__list_filtersstream their names and{}args.Full pytest collection did not run in my local checkout because the existing local
vllm/_C.abi3.soextension fails to import with a CUDA symbol mismatch before this test file loads.