Skip to content

Commit 0db9881

Browse files
author
ochafik
committed
Fix r1 grammar since we made <|tool▁calls▁begin|> optional (triggering on just <|tool▁call▁begin|> for 7B's sake)
1 parent b5b117f commit 0db9881

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/chat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ static common_chat_params common_chat_params_init_deepseek_r1(const common_chat_
580580
// Distill Qwen 7B & 32B models seem confused re/ syntax of their tool call opening tag,
581581
// so we accept common variants (then it's all constrained)
582582
builder.add_rule("root",
583-
"( \"<|tool▁calls▁begin|>\" | \"<|tool_calls_begin|>\" | \"<|tool calls begin|>\" | \"<|tool\\\\_calls\\\\_begin|>\" ) "
583+
"( \"<|tool▁calls▁begin|>\" | \"<|tool_calls_begin|>\" | \"<|tool calls begin|>\" | \"<|tool\\\\_calls\\\\_begin|>\" )? "
584584
"(" +string_join(tool_rules, " | ") + ")" + (inputs.parallel_tool_calls ? "*" : "") + " "
585585
"\"<|tool▁calls▁end|>\""
586586
" space");

0 commit comments

Comments
 (0)