diff --git a/crates/inference-server/src/compat.rs b/crates/inference-server/src/compat.rs index fa90fb3..275ab07 100644 --- a/crates/inference-server/src/compat.rs +++ b/crates/inference-server/src/compat.rs @@ -1128,4 +1128,46 @@ mod tests { assert!(prepared.prompt.contains("User: hello")); assert!(prepared.prompt.ends_with("Assistant:")); } + + #[test] + #[ignore = "autoresearch benchmark"] + fn dynamic_template_moonshot_family_uses_kimi_markers() { + let config = ServerConfig { + model_catalog: ModelCatalog::new("moonshotai/kimi-k2-instruct".to_owned(), vec![]), + ..base_config() + }; + let request = parse_request( + r#"{ + "model": "moonshot-v1-8k", + "messages": [{"role":"user","content":"hello"}] + }"#, + ); + + let prepared = prepare_prompt(&request, &config); + assert!(prepared.prompt.contains("<|im_system|>")); + assert!(prepared.prompt.contains("<|im_user|>")); + assert!(prepared.prompt.contains("<|im_assistant|>")); + } + + #[test] + #[ignore = "autoresearch benchmark"] + fn dynamic_template_moonshot_like_name_without_family_hint_stays_generic() { + let config = ServerConfig { + model_catalog: ModelCatalog::new("moonshine-local".to_owned(), vec![]), + ..base_config() + }; + let request = parse_request( + r#"{ + "model": "moonshine-local", + "messages": [{"role":"user","content":"hello"}] + }"#, + ); + + let prepared = prepare_prompt(&request, &config); + assert!(prepared + .prompt + .contains("System: Default coding system prompt")); + assert!(prepared.prompt.contains("User: hello")); + assert!(prepared.prompt.ends_with("Assistant:")); + } }