Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions include/minja/chat-template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,15 @@ class chat_template {
}), false);
caps_.supports_tools = contains(out, "some_tool");

auto out_empty = try_raw_render(json::array({dummy_user_msg, {{"role", "assistant"}, {"content", ""}}}), {}, false);
auto out_null = try_raw_render(json::array({dummy_user_msg, {{"role", "assistant"}, {"content", nullptr}}}), {}, false);
const auto render_with_content = [&](const json & content) {
const json assistant_msg {{"role", "assistant"}, {"content", content}};
// Render two assistant messages as some templates like QwQ-32B are handling
// the content differently depending on whether it's the last message or not
// (to remove the <think> tag in all but the last message).
return try_raw_render(json::array({dummy_user_msg, assistant_msg, dummy_user_msg, assistant_msg}), {}, false);
};
auto out_empty = render_with_content("");
auto out_null = render_with_content(json());
caps_.requires_non_null_content = contains(out_empty, user_needle) && !contains(out_null, user_needle);

json j_null;
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ set(MODEL_IDS
Qwen/Qwen3-235B-A22B-Instruct-2507
Qwen/Qwen3-235B-A22B-Thinking-2507
Qwen/Qwen3-Coder-30B-A3B-Instruct
Qwen/QwQ-32B

# Broken, TODO:
# Qwen/QwQ-32B
# ai21labs/AI21-Jamba-1.5-Large # https://github.com/google/minja/issues/8
# Almawave/Velvet-14B
# deepseek-ai/DeepSeek-R1
Expand Down
2 changes: 1 addition & 1 deletion tests/test-capabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ TEST(CapabilitiesTest, QwQ32B) {
EXPECT_TRUE(caps.supports_system_role);
EXPECT_TRUE(caps.supports_tools);
EXPECT_TRUE(caps.supports_tool_calls);
EXPECT_FALSE(caps.supports_tool_responses);
EXPECT_TRUE(caps.supports_tool_responses);
EXPECT_TRUE(caps.supports_parallel_tool_calls);
EXPECT_TRUE(caps.requires_object_arguments);
// EXPECT_TRUE(caps.requires_non_null_content);
Expand Down
Loading