const NATIVE_THINKING_PATTERNS: &[&str] = &[
"qwen3",
"qwq",
"deepseek-r1",
"deepseek-reasoner",
"glm-z1",
"glm-4-plus",
"glm-5",
"nanbeige",
"step-3.5",
"minimax-m2",
];
pub fn has_native_thinking(model: &str) -> bool {
let lower = model.to_ascii_lowercase();
NATIVE_THINKING_PATTERNS.iter().any(|p| lower.contains(p))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn detects_qwen3_models() {
assert!(has_native_thinking("qwen3-coder-next-80b"));
assert!(has_native_thinking("Qwen3.5-35B"));
assert!(has_native_thinking("qwen3-0.6b"));
assert!(has_native_thinking("qwen3:8b"));
assert!(has_native_thinking("qwen3-30b-a3b"));
assert!(has_native_thinking("qwen3-coder:latest"));
}
#[test]
fn detects_qwq() {
assert!(has_native_thinking("qwq-32b"));
assert!(has_native_thinking("QwQ-32B-Preview"));
}
#[test]
fn detects_deepseek_reasoning() {
assert!(has_native_thinking("deepseek-r1-distill-qwen-32b"));
assert!(has_native_thinking("deepseek-reasoner"));
}
#[test]
fn detects_glm_reasoning_variants() {
assert!(has_native_thinking("glm-z1-airx"));
assert!(has_native_thinking("glm-4-plus"));
assert!(has_native_thinking("GLM-5"));
}
#[test]
fn detects_other_reasoning_models() {
assert!(has_native_thinking("nanbeige-4.1-3b"));
assert!(has_native_thinking("step-3.5-flash-197b"));
assert!(has_native_thinking("minimax-m2.5-139b"));
assert!(has_native_thinking("MiniMax-M2.7"));
assert!(has_native_thinking("MiniMax-M2.7-highspeed"));
}
#[test]
fn rejects_non_reasoning_models() {
assert!(!has_native_thinking("gpt-4o"));
assert!(!has_native_thinking("claude-3-5-sonnet"));
assert!(!has_native_thinking("llama-3.1-70b"));
assert!(!has_native_thinking("mistral-7b"));
assert!(!has_native_thinking("gemini-2.0-flash"));
}
#[test]
fn rejects_non_reasoning_variants_in_same_family() {
assert!(!has_native_thinking("qwen2.5:7b"));
assert!(!has_native_thinking("qwen2.5-instruct"));
assert!(!has_native_thinking("glm-4-flash"));
assert!(!has_native_thinking("glm-4-air"));
assert!(!has_native_thinking("glm-4v"));
assert!(!has_native_thinking("step-3-mini"));
}
}