Repository navigation
fix(reasoning): auto-select kimi_k25 for Kimi-K2.6/K2.7 #1917
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,6 +194,8 @@ impl ParserFactory { | |
| registry.register_pattern("glm-5", "glm45"); // GLM-5.x reuse glm45 reasoning format | ||
| registry.register_pattern("kimi-k2-thinking", "kimi_thinking"); | ||
| registry.register_pattern("kimi-k2.5", "kimi_k25"); | ||
| registry.register_pattern("kimi-k2.6", "kimi_k25"); // K2.6/K2.7 share the K2.5 <think> template | ||
| registry.register_pattern("kimi-k2.7", "kimi_k25"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For auto-detected Useful? React with 👍 / 👎. |
||
| registry.register_pattern("kimi", "kimi"); // legacy: Kimi-K2-Instruct with unicode tokens | ||
| registry.register_pattern("step3", "step3"); | ||
| registry.register_pattern("minimax", "minimax"); | ||
|
|
@@ -275,6 +277,31 @@ mod tests { | |
| assert_eq!(parser.model_type(), "kimi"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_kimi_k2_family_automap() { | ||
| let factory = ParserFactory::new(); | ||
| assert_eq!( | ||
| factory.create("moonshotai/Kimi-K2.5").model_type(), | ||
| "kimi_k25" | ||
| ); | ||
| assert_eq!( | ||
| factory.create("moonshotai/Kimi-K2.6").model_type(), | ||
| "kimi_k25" | ||
| ); | ||
| assert_eq!( | ||
| factory.create("moonshotai/Kimi-K2.7-Code").model_type(), | ||
| "kimi_k25" | ||
| ); | ||
| assert_eq!( | ||
| factory.create("moonshotai/Kimi-K2-Thinking").model_type(), | ||
| "kimi_thinking" | ||
| ); | ||
| assert_eq!( | ||
| factory.create("moonshotai/Kimi-K2-Instruct").model_type(), | ||
| "kimi" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_factory_fallback_to_passthrough() { | ||
| let factory = ParserFactory::new(); | ||
|
|
||
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.
Instead of registering individual patterns for each minor version of the Kimi K2 family (e.g.,
kimi-k2.5,kimi-k2.6,kimi-k2.7), we can register a single patternkimi-k2.to match all current and future Kimi K2.x models. Since the matching logic uses substring matching (contains), this single pattern will correctly matchKimi-K2.5,Kimi-K2.6,Kimi-K2.7, and any future versions (likeKimi-K2.8), while avoiding matchingkimi-k2-thinkingorkimi-k2-instructwhich do not contain a dot afterk2.