@@ -213,6 +213,7 @@ static void assert_equals(const char* label, const T& expected, const T& actual)
213213}
214214
215215static void test_deepseek_v3_1_tool_calls () {
216+ // common_log_set_verbosity_thold(LOG_DEFAULT_DEBUG);
216217 // variant: happy path for when it works as the model card says it should
217218 const char * variant = " simple" ;
218219 common_chat_syntax syntax = {
@@ -261,6 +262,23 @@ static void test_deepseek_v3_1_tool_calls() {
261262 assert_equals (variant, std::string (" " ), m.content );
262263 assert_equals (variant, std::string (" REASONING" ), m.reasoning_content );
263264 }
265+
266+ // variant: thinking forced open + missing reasoning + no tool calls
267+ {
268+ common_chat_syntax syntax = {
269+ /* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
270+ /* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
271+ /* .reasoning_in_content = */ false ,
272+ /* .thinking_forced_open = */ true ,
273+ /* .parse_tool_calls = */ true ,
274+ };
275+ const char * variant = " thinking_forced_open_missing_reasoning_no_tool_calls" ;
276+ const std::string in = " CONTENT" ;
277+ auto m = common_chat_parse (in, false , syntax);
278+ assert_equals<std::size_t >(variant, 0 , m.tool_calls .size ());
279+ assert_equals (variant, std::string (" CONTENT" ), m.content );
280+ assert_equals (variant, std::string (" " ), m.reasoning_content );
281+ }
264282}
265283
266284static void test_with_args (const std::string & input, const std::string & expected, bool parse_as_partial = true , bool is_partial = true ) {
0 commit comments