[Bugfix] Fix Kimi-K2 tool parser concatenated tool calls parsing
[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 reproductionthree_concatenated_tool_calls: Scalability testmixed_spacing_tool_calls: Robustness testangle_brackets_in_json: Edge case with HTML in JSON
👋 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.
🚀
LGTM
Why is this not being merged?
any update on this?
@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 Could you help submit a new PR based on this one?
@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
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.