@@ -17,12 +17,12 @@ int main(void) {
1717 {" assistant" , " I am an assistant " },
1818 {" user" , " Another question" },
1919 };
20- struct ChatTemplate {
20+ struct TestCase {
2121 std::string name;
2222 std::string template_str;
2323 std::string expected_output;
2424 };
25- std::vector<ChatTemplate> templates {
25+ std::vector<TestCase> test_cases {
2626 {
2727 /* .name= */ " teknium/OpenHermes-2.5-Mistral-7B" ,
2828 /* .template_str= */ " {% for message in messages %}{{'<|im_start|>' + message['role'] + '\\ n' + message['content'] + '<|im_end|>' + '\\ n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\\ n' }}{% endif %}" ,
@@ -191,11 +191,11 @@ int main(void) {
191191 res = llama_chat_apply_template (" INVALID TEMPLATE" , conversation.data (), conversation.size (), true , formatted_chat.data (), formatted_chat.size ());
192192 assert (res < 0 );
193193
194- for (const auto & tmpl : templates ) {
195- printf (" \n\n === %s ===\n\n " , tmpl .name .c_str ());
194+ for (const auto & test_case : test_cases ) {
195+ printf (" \n\n === %s ===\n\n " , test_case .name .c_str ());
196196 formatted_chat.resize (1024 );
197197 res = llama_chat_apply_template (
198- tmpl .template_str .c_str (),
198+ test_case .template_str .c_str (),
199199 conversation.data (),
200200 conversation.size (),
201201 true ,
@@ -206,7 +206,7 @@ int main(void) {
206206 std::string output (formatted_chat.data (), formatted_chat.size ());
207207 printf (" %s\n " , output.c_str ());
208208 printf (" -------------------------\n " );
209- assert (output == tmpl .expected_output );
209+ assert (output == test_case .expected_output );
210210 }
211211
212212
0 commit comments