[PR #52] [CLOSED] fix(parser): align reasoning & tool-call parsers with upstream sglang #52

Closed
opened 2026-10-29 21:06:47 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/sglang/pull/52
Author: @yyj6666667
Created: 5/30/2026
Status: ❌ Closed

Base: main ← Head: fix/align-reasoning-parser-upstream


📝 Commits (3)

  • 5a0324a fix(reasoning): align reasoning parser with upstream sglang
  • 797b177 fix(tool-call): restore deepseekv4 tool-call-parser registration
  • 1351a10 fix(tool-call): sync kimi_k2 tool-call detector with upstream

📊 Changes

4 files changed (+424 additions, -56 deletions)

View changed files

📝 python/sglang/srt/entrypoints/openai/serving_chat.py (+20 -5)
📝 python/sglang/srt/function_call/function_call_parser.py (+2 -0)
📝 python/sglang/srt/function_call/kimik2_detector.py (+140 -37)
📝 python/sglang/srt/parser/reasoning_parser.py (+262 -14)

📄 Description

Summary

  • Sync reasoning_parser.py with upstream — add KimiK2Detector (tool-call mid-reasoning interruption), Glm45Detector, MistralDetector, HunyuanDetector, Gemma4Detector, Nemotron3Detector, _DeepSeekV3Detector, _MimoDetector, _PoolsideV1Detector; fix DetectorMap mappings (kimi_k2, glm45, deepseek-v3/v4 etc.); add tool_start_token / thinks_internally / reasoning_default to base class
  • Restore deepseekv4 tool-call-parser registration — PR #47 removed it from ToolCallParserEnum during DSV4 plugin isolation; the detector file still exists, just needs re-registration
  • Sync kimik2_detector.py (tool-call) with upstream — support bare counter tool_call_id, infer function name from argument keys, fix _last_arguments accumulating <|tool_call_end|> marker, strip residual special tokens on parse error

Test plan

  • Verified ReasoningParser('kimi_k2') resolves to KimiK2Detector with correct tool_start_token
  • Kimi K2.6 (4×5090, TP=4) with --tool-call-parser kimi_k2 --reasoning-parser kimi_k2: tool calling works correctly (reasoning_content and tool_calls properly separated)
  • Decode performance unchanged: 25-27 tok/s
  • Regression test on DeepSeek V4 Flash with --tool-call-parser deepseekv4

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/sglang/pull/52 **Author:** [@yyj6666667](https://github.com/yyj6666667) **Created:** 5/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/align-reasoning-parser-upstream` --- ### 📝 Commits (3) - [`5a0324a`](https://github.com/kvcache-ai/sglang/commit/5a0324ad40d563ce31f8048feda04961d78669a1) fix(reasoning): align reasoning parser with upstream sglang - [`797b177`](https://github.com/kvcache-ai/sglang/commit/797b177d9f14d402a5df80f8399a0575eea289df) fix(tool-call): restore deepseekv4 tool-call-parser registration - [`1351a10`](https://github.com/kvcache-ai/sglang/commit/1351a103a70eeababc5884bbd9e7bcf315c1e9de) fix(tool-call): sync kimi_k2 tool-call detector with upstream ### 📊 Changes **4 files changed** (+424 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `python/sglang/srt/entrypoints/openai/serving_chat.py` (+20 -5) 📝 `python/sglang/srt/function_call/function_call_parser.py` (+2 -0) 📝 `python/sglang/srt/function_call/kimik2_detector.py` (+140 -37) 📝 `python/sglang/srt/parser/reasoning_parser.py` (+262 -14) </details> ### 📄 Description ## Summary - **Sync `reasoning_parser.py` with upstream** — add `KimiK2Detector` (tool-call mid-reasoning interruption), `Glm45Detector`, `MistralDetector`, `HunyuanDetector`, `Gemma4Detector`, `Nemotron3Detector`, `_DeepSeekV3Detector`, `_MimoDetector`, `_PoolsideV1Detector`; fix DetectorMap mappings (`kimi_k2`, `glm45`, `deepseek-v3/v4` etc.); add `tool_start_token` / `thinks_internally` / `reasoning_default` to base class - **Restore `deepseekv4` tool-call-parser registration** — PR #47 removed it from `ToolCallParserEnum` during DSV4 plugin isolation; the detector file still exists, just needs re-registration - **Sync `kimik2_detector.py` (tool-call) with upstream** — support bare counter tool_call_id, infer function name from argument keys, fix `_last_arguments` accumulating `<|tool_call_end|>` marker, strip residual special tokens on parse error ## Test plan - [x] Verified `ReasoningParser('kimi_k2')` resolves to `KimiK2Detector` with correct `tool_start_token` - [x] Kimi K2.6 (4×5090, TP=4) with `--tool-call-parser kimi_k2 --reasoning-parser kimi_k2`: tool calling works correctly (reasoning_content and tool_calls properly separated) - [x] Decode performance unchanged: 25-27 tok/s - [ ] Regression test on DeepSeek V4 Flash with `--tool-call-parser deepseekv4` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:06:47 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/sglang#52
No description provided.