@@ -560,6 +560,7 @@ static void test_template_output_parsers() {
560
560
{
561
561
// Not supported yet
562
562
auto tmpls = read_templates (" models/templates/CohereForAI-c4ai-command-r-plus-tool_use.jinja" );
563
+ assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY, common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
563
564
assert_equals (COMMON_CHAT_FORMAT_GENERIC, common_chat_templates_apply (tmpls.get (), inputs_tools).format );
564
565
}
565
566
{
@@ -746,11 +747,8 @@ static void test_template_output_parsers() {
746
747
auto tmpls = read_templates (" models/templates/NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use.jinja" );
747
748
std::vector<std::string> end_tokens{ " <|im_end|>" };
748
749
749
- for (const auto & inputs : { inputs_no_tools, inputs_tools }) {
750
- auto params = common_chat_templates_apply (tmpls.get (), inputs);
751
- assert_equals (COMMON_CHAT_FORMAT_HERMES_2_PRO, params.format );
752
- assert_equals (false , params.thinking_forced_open );
753
- }
750
+ assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY, common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
751
+ assert_equals (COMMON_CHAT_FORMAT_HERMES_2_PRO, common_chat_templates_apply (tmpls.get (), inputs_tools).format );
754
752
assert_equals (
755
753
COMMON_CHAT_FORMAT_HERMES_2_PRO,
756
754
common_chat_templates_apply (
@@ -1022,6 +1020,7 @@ static void test_template_output_parsers() {
1022
1020
auto tmpls = read_templates (" models/templates/meta-llama-Llama-3.1-8B-Instruct.jinja" );
1023
1021
std::vector<std::string> end_tokens{ " <|eom_id|>" , " <|eot_id|>" };
1024
1022
1023
+ assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY, common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
1025
1024
assert_equals (COMMON_CHAT_FORMAT_LLAMA_3_X, common_chat_templates_apply (tmpls.get (), inputs_tools).format );
1026
1025
assert_equals (COMMON_CHAT_FORMAT_LLAMA_3_X_WITH_BUILTIN_TOOLS,
1027
1026
common_chat_templates_apply (tmpls.get (), inputs_tools_builtin).format );
@@ -1051,8 +1050,12 @@ static void test_template_output_parsers() {
1051
1050
std::vector<std::string> end_tokens{ " <|eom_id|>" , " <|eot_id|>" };
1052
1051
1053
1052
assert_equals (COMMON_CHAT_FORMAT_LLAMA_3_X, common_chat_templates_apply (tmpls.get (), inputs_tools).format );
1053
+ <<<<<<< HEAD
1054
1054
assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY,
1055
1055
common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
1056
+ =======
1057
+ assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY, common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
1058
+ >>>>>>> b6930ebc (`tool-call`: fix non-tool-calling grammar crashes w/ Qwen / Hermes 2 templates (#12900 ))
1056
1059
1057
1060
test_templates (tmpls.get (), end_tokens, message_assist, tools, " Hello, world!\n What's up?" , /* expect_grammar_triggered= */ false );
1058
1061
test_templates (tmpls.get (), end_tokens, message_assist_call, tools,
@@ -1062,6 +1065,8 @@ static void test_template_output_parsers() {
1062
1065
auto tmpls = read_templates (" models/templates/meetkai-functionary-medium-v3.1.jinja" );
1063
1066
std::vector<std::string> end_tokens{ " <|eom_id|>" , " <|eot_id|>" };
1064
1067
1068
+ assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY,
1069
+ common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
1065
1070
assert_equals (COMMON_CHAT_FORMAT_FUNCTIONARY_V3_1_LLAMA_3_1,
1066
1071
common_chat_templates_apply (tmpls.get (), inputs_tools).format );
1067
1072
assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY,
@@ -1141,6 +1146,7 @@ static void test_template_output_parsers() {
1141
1146
auto tmpls = read_templates (" models/templates/fireworks-ai-llama-3-firefunction-v2.jinja" );
1142
1147
std::vector<std::string> end_tokens{ " <|eot_id|>" };
1143
1148
1149
+ assert_equals (COMMON_CHAT_FORMAT_CONTENT_ONLY, common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
1144
1150
assert_equals (COMMON_CHAT_FORMAT_FIREFUNCTION_V2, common_chat_templates_apply (tmpls.get (), inputs_tools).format );
1145
1151
1146
1152
test_templates (tmpls.get (), end_tokens, message_assist, tools, " Hello, world!\n What's up?" , /* expect_grammar_triggered= */ false );
@@ -1152,11 +1158,17 @@ static void test_template_output_parsers() {
1152
1158
auto tmpls = read_templates (" models/templates/deepseek-ai-DeepSeek-R1-Distill-Llama-8B.jinja" );
1153
1159
std::vector<std::string> end_tokens{ " <|end▁of▁sentence|>" };
1154
1160
1161
+ <<<<<<< HEAD
1155
1162
for (const auto & inputs : { inputs_no_tools, inputs_tools }) {
1156
1163
auto params = common_chat_templates_apply (tmpls.get (), inputs);
1157
1164
assert_equals (COMMON_CHAT_FORMAT_DEEPSEEK_R1, params.format );
1158
1165
assert_equals (true , params.thinking_forced_open );
1159
1166
}
1167
+ =======
1168
+ assert_equals (COMMON_CHAT_FORMAT_DEEPSEEK_R1, common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
1169
+ assert_equals (COMMON_CHAT_FORMAT_DEEPSEEK_R1, common_chat_templates_apply (tmpls.get (), inputs_tools).format );
1170
+ assert_equals (COMMON_CHAT_FORMAT_DEEPSEEK_R1_EXTRACT_REASONING, common_chat_templates_apply (tmpls.get (), inputs_tools_think).format );
1171
+ >>>>>>> b6930ebc (`tool-call`: fix non-tool-calling grammar crashes w/ Qwen / Hermes 2 templates (#12900 ))
1160
1172
1161
1173
test_templates (tmpls.get (), end_tokens, message_assist, tools, " Hello, world!\n What's up?" , /* expect_grammar_triggered= */ false );
1162
1174
test_templates (tmpls.get (), end_tokens, message_assist_thoughts, tools, " Hello, world!\n What's up?" , /* expect_grammar_triggered= */ false );
@@ -1237,6 +1249,7 @@ static void test_template_output_parsers() {
1237
1249
auto tmpls = read_templates (" models/templates/llama-cpp-deepseek-r1.jinja" );
1238
1250
std::vector<std::string> end_tokens{ " <|end▁of▁sentence|>" };
1239
1251
1252
+ assert_equals (COMMON_CHAT_FORMAT_DEEPSEEK_R1, common_chat_templates_apply (tmpls.get (), inputs_no_tools).format );
1240
1253
assert_equals (COMMON_CHAT_FORMAT_DEEPSEEK_R1, common_chat_templates_apply (tmpls.get (), inputs_tools).format );
1241
1254
1242
1255
test_templates (tmpls.get (), end_tokens, message_assist, tools, " Hello, world!\n What's up?" , /* expect_grammar_triggered= */ false );
0 commit comments