mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-10-31 08:51:55 +00:00
Update the test
This commit is contained in:
@@ -197,7 +197,51 @@ static void test_deepseek_v3_1() {
|
||||
/* .thinking_forced_open = */ false,
|
||||
/* .parse_tool_calls = */ true,
|
||||
};
|
||||
common_chat_msg_parser builder("REASONING</think>ok", /* is_partial= */ false, {});
|
||||
common_chat_msg_parser builder("REASONING</think>ok", /* is_partial= */ false, syntax);
|
||||
assert_equals(std::string("REASONING"), builder.result().reasoning_content);
|
||||
assert_equals(std::string("ok"), builder.result().content);
|
||||
}
|
||||
|
||||
// Test with whitespace around reasoning content
|
||||
{
|
||||
common_chat_syntax syntax = {
|
||||
/* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
|
||||
/* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
|
||||
/* .reasoning_in_content = */ false,
|
||||
/* .thinking_forced_open = */ false,
|
||||
/* .parse_tool_calls = */ true,
|
||||
};
|
||||
common_chat_msg_parser builder(" REASONING WITH SPACES </think>ok", /* is_partial= */ false, syntax);
|
||||
assert_equals(std::string("REASONING WITH SPACES"), builder.result().reasoning_content);
|
||||
assert_equals(std::string("ok"), builder.result().content);
|
||||
}
|
||||
|
||||
// Test without thinking tag (should be all regular content)
|
||||
{
|
||||
common_chat_syntax syntax = {
|
||||
/* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
|
||||
/* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
|
||||
/* .reasoning_in_content = */ false,
|
||||
/* .thinking_forced_open = */ false,
|
||||
/* .parse_tool_calls = */ true,
|
||||
};
|
||||
common_chat_msg_parser builder("just regular content", /* is_partial= */ false, syntax);
|
||||
assert_equals(std::string(""), builder.result().reasoning_content);
|
||||
assert_equals(std::string("just regular content"), builder.result().content);
|
||||
}
|
||||
|
||||
// Test with empty reasoning content
|
||||
{
|
||||
common_chat_syntax syntax = {
|
||||
/* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
|
||||
/* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
|
||||
/* .reasoning_in_content = */ false,
|
||||
/* .thinking_forced_open = */ false,
|
||||
/* .parse_tool_calls = */ true,
|
||||
};
|
||||
common_chat_msg_parser builder(" </think>ok", /* is_partial= */ false, syntax);
|
||||
assert_equals(std::string(""), builder.result().reasoning_content);
|
||||
assert_equals(std::string("ok"), builder.result().content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,6 +406,7 @@ int main() {
|
||||
test_json_with_dumped_args();
|
||||
test_reasoning();
|
||||
test_regex();
|
||||
test_deepseek_v3_1();
|
||||
std::cout << "All tests passed!\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user