-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: add support for Kimi K2 Thinking model embedded tool calls #10065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds support for extracting tool calls from Kimi K2 Thinking model responses when using the OpenAI Compatible provider. The Kimi K2 Thinking model embeds tool calls in the reasoning_content field using special tags rather than the standard tool_calls field. Changes: - Added kimi-tool-call-extractor utility to parse embedded tool calls - Updated OpenAI handler to detect and extract embedded tool calls - Added comprehensive tests for the new functionality Fixes #10064
Review complete. No issues found. The latest commit correctly addresses the feedback about handling tool call markers with or without
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| * Checks if the content contains Kimi K2 Thinking model's embedded tool call markers. | ||
| */ | ||
| export function hasKimiEmbeddedToolCalls(content: string): boolean { | ||
| return content.includes("<|tool_calls_section_begin|>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take care some time it's formed as <|tool_calls_section_begin|> use only tool_calls_section_begin is working like a charmed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roomote fix that please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixaroo
See task on Roo Cloud
Fixed the tool call marker detection to handle both <|marker|> and marker formats. All local checks passed.
|
Date/time: 2025-12-17T07:22:48.014Z Unexpected API Response: The language model did not provide any assistant messages. This may indicate an issue with the API or the model's output. any plan to work on that ..... you just add deepseek reasoner but seem that you don't support OpenAi Compatible for deepseek-reasoner .... please .... i hardly need to use that model on OpenAi Compatible way .... |
Related GitHub Issue
Closes: #10064
Roo Code Task Context (Optional)
This PR was created by Roomote to address the issue.
Description
This PR adds support for extracting tool calls from Kimi K2 Thinking model responses when using the OpenAI Compatible provider.
The Kimi K2 Thinking model embeds tool calls in the
reasoning_contentfield using special tags (<|tool_calls_section_begin|>,<|tool_call_begin|>, etc.) rather than the standard OpenAItool_callsfield. This caused the "no message content" error reported in the issue.Key implementation details:
kimi-tool-call-extractor.tsutility to parse embedded tool calls from reasoning contentTest Procedure
Unit tests added for the new
kimi-tool-call-extractorutility covering:Existing OpenAI handler tests continue to pass
Run tests:
Pre-Submission Checklist
Screenshots / Videos
N/A - Backend API handling changes only
Documentation Updates
Additional Notes
This implementation is based on the code example provided by @bozoweed in issue #10064 and the Kimi K2 Thinking tool call guidance.
Feedback and guidance are welcome!
Get in Touch
Roomote Bot