Skip to content

Commit cc01b9e

Browse files
feat: new flow in the chat template test suite for Magistral
1 parent 2cd06e5 commit cc01b9e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test-chat.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ const common_chat_msg message_assist_thoughts_unparsed_md = simple_assis
411411
const common_chat_msg message_assist_thoughts_unparsed_md_partial = simple_assist_msg("<think>I'm\nthinking</think>Hello, world!\nWhat's up?\n```json\n{}");
412412

413413
const common_chat_msg message_assist_thoughts_unparsed_r7b = simple_assist_msg("<|START_THINKING|>I'm\nthinking<|END_THINKING|>Hello, world!\nWhat's up?");
414+
const common_chat_msg message_assist_thoughts_unparsed_magistral = simple_assist_msg("[THINK]raisonnement[/THINK]Réponse");
414415
const common_chat_msg message_assist_thoughts = simple_assist_msg("Hello, world!\nWhat's up?", "I'm\nthinking");
415416
const common_chat_msg message_assist_thoughts_unopened_unparsed = simple_assist_msg("I'm\nthinking</think>Hello, world!\nWhat's up?");
416417
const common_chat_msg message_assist_thoughts_no_content = simple_assist_msg("", "I'm\nthinking");
@@ -745,6 +746,17 @@ static void test_template_output_parsers() {
745746
tmpls.get(), end_tokens, message_assist_call_id, tools,
746747
"[TOOL_CALLS][{\"name\": \"special_function\", \"arguments\": {\"arg1\": 1}, \"id\": \"123456789\"}]");
747748
}
749+
{
750+
assert_msg_equals(
751+
simple_assist_msg("Réponse", "raisonnement"),
752+
common_chat_parse(
753+
message_assist_thoughts_unparsed_magistral.content,
754+
/* is_partial= */ false,
755+
{
756+
/* .format = */ COMMON_CHAT_FORMAT_MAGISTRAL,
757+
/* .reasoning_format = */ COMMON_REASONING_FORMAT_AUTO,
758+
}));
759+
}
748760
{
749761
auto tmpls = read_templates("models/templates/Qwen-QwQ-32B.jinja");
750762
std::vector<std::string> end_tokens{ "<|im_end|>" };

0 commit comments

Comments
 (0)