diff --git a/router/src/config.rs b/router/src/config.rs index 93b6f4fa..7c595e2d 100644 --- a/router/src/config.rs +++ b/router/src/config.rs @@ -414,6 +414,7 @@ pub enum Config { T5, DeepseekV2, DeepseekV3, + Qwen3, } #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/router/src/infer/chat_template.rs b/router/src/infer/chat_template.rs index a6687203..b26b3824 100644 --- a/router/src/infer/chat_template.rs +++ b/router/src/infer/chat_template.rs @@ -41,6 +41,10 @@ impl ChatTemplate { "messages[0]['content'][0]['text']", "messages[0]['content']", ); + // Hack to fix Qwen3 templating. + // It uses python notation to reverse lists, which do not exist in minijinja + // so we're using the reverse filter instead. + let mutated_template = mutated_template.replace("[::-1]", "|reverse"); let template_str = mutated_template.into_boxed_str(); env.add_function("raise_exception", raise_exception);