Skip to content

[Bugfix] Fix Unicode issues in GLM-4 tool calling#30920

Merged
youkaichao merged 1 commit intovllm-project:mainfrom
chaunceyjiang:fix_glm4_unicode
Dec 18, 2025
Merged

[Bugfix] Fix Unicode issues in GLM-4 tool calling#30920
youkaichao merged 1 commit intovllm-project:mainfrom
chaunceyjiang:fix_glm4_unicode

Conversation

@chaunceyjiang
Copy link
Copy Markdown
Collaborator

@chaunceyjiang chaunceyjiang commented Dec 18, 2025

Purpose

Test Plan

main

[ChatCompletionMessageFunctionToolCall(id='chatcmpl-tool-a206a0a9cae7c285', function=Function(arguments='{"city": "\\u5317\\u4eac", "date": "2024-06-27"}', name='get_weather'), type='function'), ChatCompletionMessageFunctionToolCall(id='chatcmpl-tool-9b1f3dc7e2f41093', function=Function(arguments='{"city": "\\u4e0a\\u6d77", "date": "2024-06-27"}', name='get_weather'), type='function')]

this pr

[ChatCompletionMessageFunctionToolCall(id='chatcmpl-tool-a206a0a9cae7c285', function=Function(arguments='{"city": "北京", "date": "2024-06-27"}', name='get_weather'), type='function'), ChatCompletionMessageFunctionToolCall(id='chatcmpl-tool-9b1f3dc7e2f41093', function=Function(arguments='{"city": "上海", "date": "2024-06-27"}', name='get_weather'), type='function')]

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes a bug in the GLM-4 tool parser where Unicode characters in tool call arguments were not being handled correctly by adding ensure_ascii=False to the json.dumps call. This prevents non-ASCII characters from being escaped. I have added one comment to further improve the robustness of the JSON serialization to prevent potential silent failures when encountering non-serializable data types.

@youkaichao youkaichao enabled auto-merge (squash) December 18, 2025 05:05
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Dec 18, 2025
@youkaichao youkaichao merged commit aa7e836 into vllm-project:main Dec 18, 2025
48 checks passed
yugong333 pushed a commit to yugong333/vllm that referenced this pull request Dec 22, 2025
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Majid-Taheri pushed a commit to Majid-Taheri/vllm that referenced this pull request Dec 23, 2025
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: Ubuntu <mjtaheri68@gmail.com>
dsuhinin pushed a commit to dsuhinin/vllm that referenced this pull request Jan 21, 2026
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
ItzDEXX pushed a commit to ItzDEXX/vllm that referenced this pull request Feb 19, 2026
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
bbrowning added a commit to bbrowning/vllm that referenced this pull request Mar 26, 2026
Audited recent tool parser bug-fix PRs and found that several
landed without corresponding test coverage. Added unit tests
for each fix to prevent regressions.

- Mistral: fast detokenization text detection (PR vllm-project#37209)
- Qwen3Coder: malformed XML crash, anyOf double-encoding,
  speculative decode streaming (PRs vllm-project#36774, vllm-project#36032, vllm-project#35615)
- DeepSeekV32: delimiter preservation with fast detokenization,
  skip_special_tokens adjustment (PR vllm-project#33964)
- GLM-4 MoE: zero-argument tool calls, transformers 5.x delimiter
  handling, Unicode character preservation (PRs vllm-project#32321, vllm-project#31622, vllm-project#30920)
- MiniMax M2: anyOf nullable parameter handling for non-null and
  null values (PR vllm-project#32342)
- Step3p5: MTP-style variable-chunk and multi-token streaming
  (PR vllm-project#33690)
- Kimi K2: native tool call ID extraction and multi-turn ID
  continuity (PR vllm-project#32768)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Signed-off-by: Ben Browning <bbrownin@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants