From 49ea5f789325df36eae222206012e7aa0c449970 Mon Sep 17 00:00:00 2001 From: Evandro Fonseca Junior Date: Thu, 26 Mar 2026 18:30:52 -0300 Subject: [PATCH] chore: expand moonshot template benchmark coverage --- crates/inference-server/src/compat.rs | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) 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:")); + } }