Skip to content

add kimi tool parser#791

Merged
awni merged 2 commits into
ml-explore:mainfrom
Evanev7:kimi-tool-parser
Jan 22, 2026
Merged

add kimi tool parser#791
awni merged 2 commits into
ml-explore:mainfrom
Evanev7:kimi-tool-parser

Conversation

@Evanev7
Copy link
Copy Markdown
Contributor

@Evanev7 Evanev7 commented Jan 21, 2026

Adds a tool parser based on the glm47 and vllm tool parser. Some points of note:

  • Kimi-K2 has a <|start_tool_calls_section|> in which it makes multiple calls. I don't handle this, and I don't think the rest of the code intends to, but would a follow up PR aiming to address this kind of parallel tool calling be appreciated? I'm not sure how much you want PRs making larger changes to the repo.
  • I couldn't actually get the loading logic correct with the full kimi-k2. I tested the parsing code manually with some custom ignores for the calls section, but the loading might need to change.

@awni
Copy link
Copy Markdown
Member

awni commented Jan 21, 2026

Looks great. Could you please add a test here https://github.com/ml-explore/mlx-lm/blob/main/tests/test_tool_parsing.py ?

@awni awni force-pushed the kimi-tool-parser branch from 95e12ab to f7ff983 Compare January 22, 2026 15:35
Copy link
Copy Markdown
Member

@awni awni left a comment

Choose a reason for hiding this comment

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

LGTM!

@awni awni merged commit e5ddaff into ml-explore:main Jan 22, 2026
2 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.

2 participants