@@ -194,54 +194,13 @@ static void test_deepseek_v3_1() {
194194 /* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
195195 /* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
196196 /* .reasoning_in_content = */ false ,
197- /* .thinking_forced_open = */ false ,
197+ /* .thinking_forced_open = */ true ,
198198 /* .parse_tool_calls = */ true ,
199199 };
200200 common_chat_msg_parser builder (" REASONING</think>ok" , /* is_partial= */ false , syntax);
201+ assert_equals (true , builder.try_parse_reasoning (" <think>" , " </think>" ));
201202 assert_equals (std::string (" REASONING" ), builder.result ().reasoning_content );
202- assert_equals (std::string (" ok" ), builder.result ().content );
203- }
204-
205- // Test with whitespace around reasoning content
206- {
207- common_chat_syntax syntax = {
208- /* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
209- /* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
210- /* .reasoning_in_content = */ false ,
211- /* .thinking_forced_open = */ false ,
212- /* .parse_tool_calls = */ true ,
213- };
214- common_chat_msg_parser builder (" REASONING WITH SPACES </think>ok" , /* is_partial= */ false , syntax);
215- assert_equals (std::string (" REASONING WITH SPACES" ), builder.result ().reasoning_content );
216- assert_equals (std::string (" ok" ), builder.result ().content );
217- }
218-
219- // Test without thinking tag (should be all regular content)
220- {
221- common_chat_syntax syntax = {
222- /* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
223- /* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
224- /* .reasoning_in_content = */ false ,
225- /* .thinking_forced_open = */ false ,
226- /* .parse_tool_calls = */ true ,
227- };
228- common_chat_msg_parser builder (" just regular content" , /* is_partial= */ false , syntax);
229- assert_equals (std::string (" " ), builder.result ().reasoning_content );
230- assert_equals (std::string (" just regular content" ), builder.result ().content );
231- }
232-
233- // Test with empty reasoning content
234- {
235- common_chat_syntax syntax = {
236- /* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
237- /* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
238- /* .reasoning_in_content = */ false ,
239- /* .thinking_forced_open = */ false ,
240- /* .parse_tool_calls = */ true ,
241- };
242- common_chat_msg_parser builder (" </think>ok" , /* is_partial= */ false , syntax);
243- assert_equals (std::string (" " ), builder.result ().reasoning_content );
244- assert_equals (std::string (" ok" ), builder.result ().content );
203+ assert_equals (std::string (" ok" ), builder.consume_rest ());
245204 }
246205}
247206
0 commit comments