Skip to content

feat(frontend): add native Kimi K3 request processing - #12396

Merged
rmccorm4 merged 3 commits into
mainfrom
qiwa/k3-native-frontend
Jul 30, 2026
Merged

feat(frontend): add native Kimi K3 request processing#12396
rmccorm4 merged 3 commits into
mainfrom
qiwa/k3-native-frontend

Conversation

@furionw

@furionw furionw commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • upgrade the released frontend crates for Kimi K3 rendering, parsing, and segmented tokenization
  • add native K3 thinking, XTML tool-call, named-tool, and response wrapper handling
  • preserve special-token boundaries through Rust, C, and inference-gateway preprocessing
  • return client errors for invalid renderer inputs and malformed tool schemas

Stack

Base: main

PR2 and PR3 branch independently from this PR.

Validation

  • cargo fmt --all -- --check
  • cargo check -p dynamo-llm --no-default-features --locked
  • targeted Kimi K3 tests: 4 passed
  • pre-commit run --all-files
  • Graham-style Rust review: PASS, no findings

Summary by CodeRabbit

  • New Features
    • Improved Kimi K3 tool-calling support, including native XTML structural tags and better reasoning behavior.
    • Added model-aware prompt formatting and more accurate tokenization for rendered chat prompts.
    • Improved handling and reporting of invalid prompt-rendering requests.
  • Bug Fixes
    • Corrected tool-choice validation and guided decoding behavior for Kimi K3 requests.
    • Validated tool parameter schemas more reliably while allowing omitted parameters.
  • Documentation
    • Clarified command-line help and tool-choice guidance for Kimi K3 behavior.

@github-actions github-actions Bot added feat frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` labels Jul 29, 2026
@datadog-official

This comment has been minimized.

@furionw
furionw marked this pull request as ready for review July 29, 2026 22:18
@furionw
furionw requested review from a team as code owners July 29, 2026 22:18
devin-ai-integration[bot]

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR updates renderer dependencies, preserves rendered prompt segments during tokenization, adds Kimi K3 formatter and parser-specific reasoning/tool handling, validates tool parameter schemas, and updates integrations, help text, and tests.

Changes

Preprocessing and validation

Layer / File(s) Summary
Renderer dependencies and Kimi K3 formatter selection
Cargo.toml, lib/bindings/python/Cargo.toml, lib/llm/src/preprocessor/prompt.rs
Renderer and parser versions are updated, and Kimi K3 formatter selection is added before existing fallback formatters.
Rendered prompt tokenization and error mapping
lib/llm/src/preprocessor.rs, deploy/inference-gateway/ext-proc/src/epp.rs, lib/bindings/c/src/lib.rs
Template rendering returns RenderedPrompt, maps invalid render requests, and uses segment-aware tokenization across preprocessing integrations.
Kimi K3 tool choice and structural tagging
lib/llm/src/preprocessor.rs, lib/llm/src/preprocessor/structural_tag.rs, lib/llm/src/preprocessor/tool_choice.rs, components/src/dynamo/common/configuration/groups/runtime_args.py
Kimi K3 named-tool requests disable template thinking, require intrinsic XTML structural tags, and bypass incompatible JSON guided decoding.
Kimi K3 streaming and reasoning parser behavior
lib/llm/src/preprocessor.rs
Kimi K3 aliases are included in tool-jail, special-token, reasoning-marker, and reasoning-gating paths with corresponding tests.
Tool parameter schema validation
lib/llm/src/protocols/openai/validate.rs, lib/llm/src/protocols/openai/chat_completions.rs
Provided tool parameters must be JSON Schema objects; omitted parameters remain accepted.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, stack, and validation, but it misses the required Overview, Details, reviewer-start, and Related Issues sections. Rewrite it to follow the template: add Overview, Details, reviewer-start files, and the required Related Issues section with either Closes/Relates to #XXXX or a no-issue declaration.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: adding native Kimi K3 request processing, though it omits the broader preprocessing and schema-validation updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
lib/bindings/python/Cargo.toml (1)

56-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Same unpinned dynamo-parsers version as the root manifest.

See the consolidated comment covering both Cargo.toml and this file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/bindings/python/Cargo.toml` at line 56, Update the dynamo-parsers
dependency declaration in the Python bindings manifest to use the same pinned
version specification as the root Cargo manifest, keeping both manifests
synchronized.
Cargo.toml (1)

52-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent version pinning for dynamo-parsers.

dynamo-tokenizers, dynamo-renderer, and dynamo-protocols are pinned exactly (=1.7.0, =5.0.0, =5.0.1), but dynamo-parsers uses "7.0.0" (Cargo's default caret range, allowing >=7.0.0, <8.0.0). Since this PR is bumping several of these lock-step "frontend crates" together specifically to add K3 support, leaving one of them unpinned risks it drifting to an incompatible minor version relative to its siblings.

🔧 Proposed fix
-dynamo-parsers = { version = "7.0.0" }
+dynamo-parsers = { version = "=7.0.0" }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Cargo.toml` around lines 52 - 62, Pin the dynamo-parsers dependency exactly
to version 7.0.0, matching the exact-version constraints used by
dynamo-tokenizers, dynamo-renderer, and dynamo-protocols. Update only the
version declaration for dynamo-parsers and preserve its existing dependency
configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Cargo.toml`:
- Around line 52-62: Pin the dynamo-parsers dependency exactly to version 7.0.0,
matching the exact-version constraints used by dynamo-tokenizers,
dynamo-renderer, and dynamo-protocols. Update only the version declaration for
dynamo-parsers and preserve its existing dependency configuration.

In `@lib/bindings/python/Cargo.toml`:
- Line 56: Update the dynamo-parsers dependency declaration in the Python
bindings manifest to use the same pinned version specification as the root Cargo
manifest, keeping both manifests synchronized.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fd3ea7fd-f331-462e-bb62-e6c2e973a090

📥 Commits

Reviewing files that changed from the base of the PR and between 0e1d1d8 and ce4c8f0.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • lib/bindings/kvbm/Cargo.lock is excluded by !**/*.lock
  • lib/bindings/python/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • Cargo.toml
  • components/src/dynamo/common/configuration/groups/runtime_args.py
  • deploy/inference-gateway/ext-proc/src/epp.rs
  • lib/bindings/c/src/lib.rs
  • lib/bindings/python/Cargo.toml
  • lib/llm/src/preprocessor.rs
  • lib/llm/src/preprocessor/prompt.rs
  • lib/llm/src/preprocessor/structural_tag.rs
  • lib/llm/src/preprocessor/tool_choice.rs
  • lib/llm/src/protocols/openai/chat_completions.rs
  • lib/llm/src/protocols/openai/validate.rs

Signed-off-by: Ryan McCormick <rmccormick@nvidia.com>
@rmccorm4

Copy link
Copy Markdown
Contributor

#12203 (just merged) should help with TRTLLM CI test failures

  [w5]         error_data = {'code': 400, 'message': 'ValueError: node_id must be in range [0, 256)', 'type': 'Bad Request'}

@rmccorm4
rmccorm4 merged commit 7d229e6 into main Jul 30, 2026
114 checks passed
@rmccorm4
rmccorm4 deleted the qiwa/k3-native-frontend branch July 30, 2026 04:21
zhaoxianhua added a commit to zhaoxianhua/dynamo that referenced this pull request Jul 31, 2026
Signed-off-by: Ryan McCormick <rmccormick@nvidia.com>
Co-authored-by: Ryan McCormick <rmccormick@nvidia.com>
githubgxll pushed a commit to githubgxll/dynamo that referenced this pull request Jul 31, 2026
Signed-off-by: Ryan McCormick <rmccormick@nvidia.com>
Co-authored-by: Ryan McCormick <rmccormick@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat frontend `python -m dynamo.frontend` and `dynamo-run in=http|text|grpc` size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants