vllm icon indicating copy to clipboard operation
vllm copied to clipboard

[Bugfix] Fix Kimi-K2 tool parser concatenated tool calls parsing

Open yiyeguhu opened this issue 3 months ago • 5 comments

[Bugfix] Fix Kimi-K2 tool parser concatenated tool calls parsing

Purpose

  • Resolves GitHub issue #24478
  • Fix regex pattern to handle concatenated tool calls without spacing
  • Use negative lookahead to prevent over-matching across tool call boundaries
  • Add comprehensive test cases for edge cases including angle brackets in JSON
  • Consolidate test cases into parametrized test for better maintainability

Test Plan

pytest tests/tool_use/test_kimi_k2_tool_parser.py

Test Result

All 11 tests pass, including 4 new test cases that validate the regex fix:

  • concatenated_tool_calls_bug_fix: Exact GitHub issue reproduction
  • three_concatenated_tool_calls: Scalability test
  • mixed_spacing_tool_calls: Robustness test
  • angle_brackets_in_json: Edge case with HTML in JSON

yiyeguhu avatar Sep 15 '25 03:09 yiyeguhu

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

github-actions[bot] avatar Sep 15 '25 03:09 github-actions[bot]

LGTM

MoyanZitto avatar Oct 15 '25 03:10 MoyanZitto

Why is this not being merged?

wizche avatar Nov 11 '25 10:11 wizche

any update on this?

mehmetbaykar avatar Nov 14 '25 22:11 mehmetbaykar

@yiyeguhu Could you fix the pre-commit issues, all other tests seem to have passed! See here: https://github.com/vllm-project/vllm/actions/runs/19263038741/job/55072168601?pr=24847

bbartels avatar Nov 14 '25 22:11 bbartels

@bbartels Could you help submit a new PR based on this one?

chaunceyjiang avatar Nov 17 '25 02:11 chaunceyjiang

@bbartels Could you help submit a new PR based on this one?

@chaunceyjiang Have a look at https://github.com/vllm-project/vllm/pull/28831

bbartels avatar Nov 17 '25 03:11 bbartels

Hi @yiyeguhu, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

mergify[bot] avatar Dec 05 '25 14:12 mergify[bot]