@@ -998,6 +998,7 @@ static void test_peg_parser(common_chat_templates * tmpls,
998998 auto parser = make_peg_parser (tmpls, tc.params , detailed_debug);
999999 if (detailed_debug) {
10001000 LOG_DBG (" Using parser: \n %s\n " , parser.arena_ .dump (parser.arena_ .root ()).c_str ());
1001+ LOG_DBG (" Generation prompt: '%s'\n " , parser.params_ .generation_prompt .c_str ());
10011002 }
10021003
10031004 common_chat_msg msg_accum;
@@ -3102,8 +3103,19 @@ static void test_template_output_peg_parsers(bool detailed_debug) {
31023103 // Format: <minimax:tool_call><invoke name="func"><parameter name="key">value</parameter></invoke></minimax:tool_call>
31033104 {
31043105 auto tst = peg_tester (" models/templates/MiniMax-M2.jinja" , detailed_debug);
3106+ tst.test (" </think>Hello, world!\n What's up?" ).enable_thinking (true ).reasoning_format (COMMON_REASONING_FORMAT_AUTO).expect (message_assist).run ();
3107+
3108+ tst.test (" I'm\n thinking</think>Hello, world!\n What's up?" ).enable_thinking (true ).reasoning_format (COMMON_REASONING_FORMAT_AUTO).expect (message_assist_thoughts).run ();
3109+
3110+ tst.test (" Let's call a tool:</think><minimax:tool_call>\n <invoke name=\" empty_args\" >\n </invoke>\n </minimax:tool_call>" ).
3111+ enable_thinking (true ).
3112+ reasoning_format (COMMON_REASONING_FORMAT_AUTO).
3113+ tools ({ empty_args_tool }).
3114+ expect (message_with_reasoning_and_tool_call (" Let's call a tool:" , " empty_args" , " {}" )).
3115+ run ();
3116+
31053117 tst.test (
3106- " <minimax:tool_call>\n <invoke name=\" special_function\" >\n <parameter "
3118+ " </think>< minimax:tool_call>\n <invoke name=\" special_function\" >\n <parameter "
31073119 " name=\" arg1\" >1</parameter>\n </invoke>\n </minimax:tool_call>" )
31083120 .tools ({ special_function_tool })
31093121 .expect (message_assist_call)
0 commit comments