@@ -289,7 +289,7 @@ static void test_template(const common_chat_template & tmpl, const std::vector<s
289289static void test_template_output_parsers () {
290290 json text_message {
291291 { " role" , " assistant" },
292- { " content" , " Hello, world!" },
292+ { " content" , " Hello, world!\n What's up? " },
293293 };
294294 json tool_calls = json::array ({{
295295 { " type" , " function" },
@@ -379,7 +379,7 @@ static void test_template_output_parsers() {
379379
380380 common_chat_inputs inputs_no_tools;
381381 inputs_no_tools.messages = {
382- { { " role" , " user" }, { " content" , " Hey" } }
382+ { { " role" , " user" }, { " content" , " Hey\n There " } }
383383 };
384384
385385 common_chat_inputs inputs_tools = inputs_no_tools;
@@ -408,7 +408,8 @@ static void test_template_output_parsers() {
408408 " {\" tool_call_id\" : \" 0\" , \" tool_name\" : \" special_function\" , \" parameters\" : {\" arg1\" : 1}}\n "
409409 " ]<|END_ACTION|>" );
410410 test_template (tmpl, end_tokens, text_message, tools,
411- " <|START_RESPONSE|>Hello, world!<|END_RESPONSE|>" ,
411+ " <|START_RESPONSE|>Hello, world!\n "
412+ " What's up?<|END_RESPONSE|>" ,
412413 /* expect_grammar_triggered= */ false );
413414 }
414415 {
@@ -428,7 +429,7 @@ static void test_template_output_parsers() {
428429
429430 assert_msg_equals (msg_from_json (text_message),
430431 common_chat_parse (" {\n "
431- " \" response\" : \" Hello, world!\"\n "
432+ " \" response\" : \" Hello, world!\\ nWhat's up? \ "\n"
432433 " }" ,
433434 common_chat_params_init (tmpl, inputs_tools).format ));
434435 test_template (tmpl, end_tokens, tool_call_message_with_id, tools,
@@ -451,7 +452,7 @@ static void test_template_output_parsers() {
451452
452453 assert_equals (COMMON_CHAT_FORMAT_MISTRAL_NEMO, common_chat_params_init (tmpl, inputs_tools).format );
453454
454- test_template (tmpl, end_tokens, text_message, tools, " Hello, world!" , /* expect_grammar_triggered= */ false );
455+ test_template (tmpl, end_tokens, text_message, tools, " Hello, world!\n What's up? " , /* expect_grammar_triggered= */ false );
455456 test_template (
456457 tmpl, end_tokens, tool_call_message_with_id, tools,
457458 " [TOOL_CALLS][{\" name\" : \" special_function\" , \" arguments\" : {\" arg1\" : 1}, \" id\" : \" 123456789\" }]" );
@@ -476,7 +477,7 @@ static void test_template_output_parsers() {
476477 inputs_tools)
477478 .format );
478479
479- test_template (tmpl, end_tokens, text_message, tools, " Hello, world!" , /* expect_grammar_triggered= */ false );
480+ test_template (tmpl, end_tokens, text_message, tools, " Hello, world!\n What's up? " , /* expect_grammar_triggered= */ false );
480481 test_template (tmpl, end_tokens, tool_call_message, tools,
481482 " <tool_call>\n "
482483 " {\" name\" : \" special_function\" , \" arguments\" : {\" arg1\" : 1}}\n "
@@ -516,7 +517,7 @@ static void test_template_output_parsers() {
516517
517518 assert_equals (COMMON_CHAT_FORMAT_LLAMA_3_X, common_chat_params_init (tmpl, inputs_tools).format );
518519
519- test_template (tmpl, end_tokens, text_message, tools, " Hello, world!" , /* expect_grammar_triggered= */ false );
520+ test_template (tmpl, end_tokens, text_message, tools, " Hello, world!\n What's up? " , /* expect_grammar_triggered= */ false );
520521 test_template (tmpl, end_tokens, tool_call_message, tools,
521522 " {\" name\" : \" special_function\" , \" parameters\" : {\" arg1\" : 1}}" );
522523 }
@@ -528,7 +529,7 @@ static void test_template_output_parsers() {
528529 assert_equals (COMMON_CHAT_FORMAT_FUNCTIONARY_V3_1_LLAMA_3_1,
529530 common_chat_params_init (tmpl, inputs_tools).format );
530531
531- test_template (tmpl, end_tokens, text_message, tools, " Hello, world!" , /* expect_grammar_triggered= */ false );
532+ test_template (tmpl, end_tokens, text_message, tools, " Hello, world!\n What's up? " , /* expect_grammar_triggered= */ false );
532533 test_template (tmpl, end_tokens, tool_call_message, tools,
533534 " <function=special_function>{\" arg1\" : 1}</function>" );
534535 }
@@ -542,7 +543,8 @@ static void test_template_output_parsers() {
542543
543544 test_template (tmpl, end_tokens, text_message, {},
544545 " all\n "
545- " Hello, world!" ,
546+ " Hello, world!\n "
547+ " What's up?" ,
546548 /* expect_grammar_triggered= */ false );
547549 test_template (tmpl, end_tokens, tool_call_message, tools,
548550 " special_function\n "
@@ -555,7 +557,7 @@ static void test_template_output_parsers() {
555557
556558 assert_equals (COMMON_CHAT_FORMAT_FIREFUNCTION_V2, common_chat_params_init (tmpl, inputs_tools).format );
557559
558- test_template (tmpl, end_tokens, text_message, tools, " Hello, world!" , /* expect_grammar_triggered= */ false );
560+ test_template (tmpl, end_tokens, text_message, tools, " Hello, world!\n What's up? " , /* expect_grammar_triggered= */ false );
559561 test_template (tmpl, end_tokens, tool_call_message, tools,
560562 " functools[{\" name\" : \" special_function\" , \" arguments\" : {\" arg1\" : 1}}]" );
561563 }
@@ -566,7 +568,7 @@ static void test_template_output_parsers() {
566568
567569 assert_equals (COMMON_CHAT_FORMAT_DEEPSEEK_R1, common_chat_params_init (tmpl, inputs_tools).format );
568570
569- test_template (tmpl, end_tokens, text_message, tools, " Hello, world!" , /* expect_grammar_triggered= */ false );
571+ test_template (tmpl, end_tokens, text_message, tools, " Hello, world!\n What's up? " , /* expect_grammar_triggered= */ false );
570572 test_template (tmpl, end_tokens, tool_call_message, tools,
571573 " <|tool▁calls▁begin|><|tool▁call▁begin|>function<|tool▁sep|>special_function\n "
572574 " ```json\n "
0 commit comments