From 1c17d8a76825915791cfc3ddfa75ba895fe67479 Mon Sep 17 00:00:00 2001 From: Alvaro Bartolome <36760800+alvarobartt@users.noreply.github.com> Date: Fri, 31 Jan 2025 21:41:15 +0100 Subject: [PATCH] Fix `test_chat_template_valid_with_strftime_now` --- router/src/infer/chat_template.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/router/src/infer/chat_template.rs b/router/src/infer/chat_template.rs index 61c8eed0..00938aba 100644 --- a/router/src/infer/chat_template.rs +++ b/router/src/infer/chat_template.rs @@ -325,7 +325,8 @@ mod tests { let source = r#" {% set today = strftime_now("%Y-%m-%d") %} - {% set default_system_message = "The current date is " + today + ".\n" %} + {% set default_system_message = "The current date is " + today + "." %} + {{ default_system_message }} {{ bos_token }} {% if messages[0]['role'] == 'system' %} {% set loop_messages = messages[1:] %} @@ -379,7 +380,7 @@ mod tests { let current_date = Local::now().format("%Y-%m-%d").to_string(); let result = tmpl.unwrap().render(chat_template_inputs).unwrap(); - assert_eq!(result, format!("The current date is {}. [BOS][INST] Hi! [/INST]Hello how can I help?[EOS][INST] What is Deep Learning? [/INST]magic![EOS]", current_date)); + assert_eq!(result, format!("The current date is {}.[BOS][INST] Hi! [/INST]Hello how can I help?[EOS][INST] What is Deep Learning? [/INST]magic![EOS]", current_date)); } #[test]