Skip to content

[fix] Add tool call parser KimiK2RawIdDetector to keep original tool call id. - #25196

Merged
JustinTong0323 merged 1 commit into
sgl-project:sglang-milesfrom
guapisolo:fix/kimi_k2_raw_id
May 14, 2026
Merged

[fix] Add tool call parser KimiK2RawIdDetector to keep original tool call id.#25196
JustinTong0323 merged 1 commit into
sgl-project:sglang-milesfrom
guapisolo:fix/kimi_k2_raw_id

Conversation

@guapisolo

@guapisolo guapisolo commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Motivation

The default kimi_k2 path renumbers ids via history_tool_calls_cnt + tool_index in the serving layer so that multi-turn conversations get globally unique, monotonically increasing ids (see PR #10600). That is the right behavior for chat use cases.
However, RL training has the opposite requirement: the trajectory must round-trip the exact tool_call_id the model produced (e.g. functions.foo:5), so that the follow-up tool result turn references the same id the policy emitted. This subclass exists purely as a marker so the serving layer can branch on the parser name and use ToolCallItem.tool_call_id directly. Parsing logic is identical to KimiK2Detector.

Modifications

Add a new KimiK2RawIdDetector to tool call parser, distinguished from original kimi_k2 tool call parser.

Accuracy Tests

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@JustinTong0323
JustinTong0323 merged commit 6ae242b into sgl-project:sglang-miles May 14, 2026
1 check passed
JessicaJiang-123 pushed a commit to JessicaJiang-123/sglang that referenced this pull request Jun 21, 2026
nanjiangwill pushed a commit to nanjiangwill/sglang that referenced this pull request Jul 7, 2026
XinyuJiangCMU pushed a commit to XinyuJiangCMU/sglang that referenced this pull request Jul 17, 2026
…#25196)

Re-applied onto v0.5.15's rewritten kimik2_detector: capture the
model-emitted id at both ToolCallItem sites (streaming gated on the
name-carrying delta), add KimiK2RawIdDetector + registry + serving_chat
branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants