feat(parser): route GLM-5.x to existing GLM-4.7/4.5 parsers#1833
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughTwo factory registrations are added: ChangesGLM-5 Parser Routing
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request adds support for GLM-5.x models by routing them to existing parsers. Specifically, GLM-5.x models are configured to reuse the 'glm45' reasoning format in 'reasoning_parser' and the 'glm47_moe' tool parser in 'tool_parser'. Corresponding unit tests have been added to verify correct routing and parsing behavior. There are no review comments, and we have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Clean PR — minimal routing additions with good test coverage. The longest-prefix-wins semantics in the tool parser registry guarantee glm-5* beats the glm-* catch-all, and the reasoning parser substring match on "glm-5" correctly covers all GLM-5.x variants. No issues found.
GLM-5/5.1/5.2 use the same tool-call format as GLM-4.7 (glm47_moe) and the same <think> reasoning format as GLM-4.5 (glm45), matching vLLM's --tool-call-parser glm47 --reasoning-parser glm45. Add model-ID mappings so canonical glm-5.x IDs auto-resolve to those parsers instead of falling through to the glm-* -> json catch-all. Signed-off-by: key4ng <rukeyang@gmail.com>
8aff84c to
363fb53
Compare
Description
Problem
SMG had no routing for GLM-5/5.1/5.2 model IDs. A model ID like
glm-5.2-fp8fell through the tool-parser catch-allglm-*->json(which cannot parse GLM's<arg_key>/<arg_value>XML, silently breaking tool calls), and matched no reasoning pattern (falling back to the default parser, so reasoning was not extracted).Solution
GLM-5.x reuse existing formats — no new parser code needed. They use the GLM-4.7 tool-call format (
glm47_moe/Glm4MoeParser::glm47()) and the GLM-4.5<think>/</think>reasoning format (glm45). This mirrors vLLM's published serving command for GLM-5.2:--tool-call-parser glm47 --reasoning-parser glm45. GLM-5.2 swappedenable_thinkingfor areasoning_effortfield, but the emitted delimiters are unchanged, so the parsers are unaffected.Changes
tool_parser/src/factory.rs: mapglm-5*->glm47_moe(longest-prefix-wins beats theglm-*->jsoncatch-all).reasoning_parser/src/factory.rs: register substring patternglm-5->glm45.glm-5{,.1,.2,.2-fp8}route toglm47_moeand extract a tool call; one-line assertion in the reasoning factory test.Test Plan
cargo test -p tool-parser -p reasoning-parser— all suites pass, including the newtest_glm5_routes_to_glm47_moe.cargo +nightly fmt --all -- --check— clean.cargo clippy -p tool-parser -p reasoning-parser --all-targets --all-features -- -D warnings— clean.Checklist
cargo +nightly fmtpassescargo clippy --all-targets --all-features -- -D warningspassesSummary by CodeRabbit