Skip to content

fix: generate random tool call IDs and support non-standard ID format…#4

Merged
shivamashtikar merged 1 commit into
kimi-2.6-v0.19.1-custom-fixesfrom
kimi-2.6-tool-call-fix
May 18, 2026
Merged

fix: generate random tool call IDs and support non-standard ID format…#4
shivamashtikar merged 1 commit into
kimi-2.6-v0.19.1-custom-fixesfrom
kimi-2.6-tool-call-fix

Conversation

@shivamashtikar

@shivamashtikar shivamashtikar commented May 18, 2026

Copy link
Copy Markdown
Collaborator

…s in Kimi K2 parser

  • Replace model-native tool call IDs (e.g. 'functions.get_weather:0') with random UUIDs via make_tool_call_id() to prevent ID collisions across multi-turn agent loops.
  • Broaden regex patterns to accept non-standard tool call IDs (e.g. 'toolu_vrtx_xxx', 'call_xxx') instead of only 'name:index' format.
  • Add _extract_function_name() with 3 strategies: parse standard ID format, match argument keys against request tool schemas (parameter overlap), and fallback to raw ID.
  • Guard against empty tool call extraction when section markers are present but no calls are parsed (return tools_called=False).
  • Update tests: remove hardcoded expected IDs, assert random ID format, add tests for parameter-overlap resolution, ID uniqueness, and edge cases.

Purpose

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@github-actions

Copy link
Copy Markdown

👋 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.

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.

🚀

@shivamashtikar shivamashtikar force-pushed the kimi-2.6-tool-call-fix branch from d6baae8 to 2eb9703 Compare May 18, 2026 21:53
…raction in Kimi K2 parser

- Generate random chatcmpl-tool-<uuid> IDs via make_tool_call_id()
  instead of exposing model-native IDs to clients, preventing ID
  collisions across multi-turn agent loops.
- Fix streaming regex to handle leading whitespace emitted by the
  tokenizer before tool call IDs (\s* prefix on streaming regexes).
- Restore original regex ID pattern requiring :\d+ format since
  non-standard ID formats are no longer supported.
- Simplify _extract_function_name: remove parameter-overlap matching
  and raw-ID fallback strategies (dead code for Kimi K2's native
  format), drop unused arguments/request parameters.
- Guard against empty tool call extraction when section markers are
  present but no calls are parsed (return tools_called=False).
- Update tests: assert random ID format, add uniqueness tests, add
  dot-split partial ID test, remove non-standard ID format tests.
@shivamashtikar shivamashtikar force-pushed the kimi-2.6-tool-call-fix branch from 2eb9703 to b45c7d6 Compare May 18, 2026 22:01
@shivamashtikar shivamashtikar merged commit 17505a7 into kimi-2.6-v0.19.1-custom-fixes May 18, 2026
3 of 4 checks passed
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.

1 participant