Skip to content

Commit df3474e

Browse files
author
Olivier Chafik
committed
tool-calls: r1: add missing <|tool▁calls▁end|> to grammar!
1 parent 08271b5 commit df3474e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

common/chat.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,15 @@ static common_chat_params common_chat_params_init_deepseek_r1(const common_chat_
552552
"<think>",
553553
"</think>",
554554
"<|tool▁sep|>",
555+
"<|tool▁calls▁end|",
556+
"<|tool▁call▁begin|>",
555557
"<|tool▁call▁end|>",
556558
};
557-
builder.add_rule("root", "\"<|tool▁calls▁begin|>\" (" + string_join(tool_rules, " | ") + ")" + (inputs.parallel_tool_calls ? "*" : "") + " space");
559+
builder.add_rule("root",
560+
"\"<|tool▁calls▁begin|>\""
561+
" (" +string_join(tool_rules, " | ") + ")" + (inputs.parallel_tool_calls ? "*" : "") +
562+
"\"<|tool▁calls▁end|>\""
563+
" space");
558564
}, grammar_options);
559565
/*
560566
Note: we do not feed the thoughts back to the template for a few reasons:

0 commit comments

Comments
 (0)