@@ -114,10 +114,26 @@ static void test_reasoning() {
114114        /*  .thinking_forced_open = */ true ,
115115        /*  .parse_tool_calls = */ true ,
116116    };
117+     const  std::string variant (" deepseek_v3_1_reasoning_format_deepseek" 
117118    common_chat_msg_parser builder (" REASONING</think>ok" /*  is_partial= */ false , syntax);
118-     assert_equals (true , builder.try_parse_reasoning (" <think>" " </think>" 
119-     assert_equals (std::string (" REASONING" result ().reasoning_content );
120-     assert_equals (std::string (" ok" consume_rest ());
119+     assert_equals (variant, true , builder.try_parse_reasoning (" <think>" " </think>" 
120+     assert_equals (variant, std::string (" REASONING" result ().reasoning_content );
121+     assert_equals (variant, std::string (" ok" consume_rest ());
122+   }
123+   //  Test DeepSeek V3.1 parsing - reasoning_format none - reasoning content followed by "</think>" and then regular content
124+   {
125+     common_chat_syntax syntax = {
126+         /*  .format = */ 
127+         /*  .reasoning_format = */ 
128+         /*  .reasoning_in_content = */ false ,
129+         /*  .thinking_forced_open = */ true ,
130+         /*  .parse_tool_calls = */ true ,
131+     };
132+     const  std::string variant (" deepseek_v3_1_reasoning_format_none" 
133+     const  std::string input = " REASONING</think>ok" 
134+     auto  msg = common_chat_parse (input, false , syntax);
135+     assert_equals (variant, std::string (" REASONING</think>ok" content );
136+     assert_equals (variant, std::string (" " reasoning_content );
121137  }
122138}
123139
0 commit comments