Fixing the router + template for Qwen3. (#3200)

This commit is contained in:
Nicolas Patry 2025-04-29 16:29:26 +02:00 committed by GitHub
parent 39cfe232fd
commit e7329fec18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -414,6 +414,7 @@ pub enum Config {
T5,
DeepseekV2,
DeepseekV3,
Qwen3,
}
#[derive(Clone, Debug, Serialize, Deserialize)]

View File

@ -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);