From df3474e2c2153dec135b93ad630956ce3aa5e40e Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Mon, 3 Feb 2025 17:33:14 +0000 Subject: [PATCH] =?UTF-8?q?tool-calls:=20r1:=20add=20missing=20<=EF=BD=9Ct?= =?UTF-8?q?ool=E2=96=81calls=E2=96=81end=EF=BD=9C>=20to=20grammar!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/chat.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/chat.cpp b/common/chat.cpp index 0e8a75654..1b9bc798c 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -552,9 +552,15 @@ static common_chat_params common_chat_params_init_deepseek_r1(const common_chat_ "", "", "<|tool▁sep|>", + "<|tool▁calls▁end|", + "<|tool▁call▁begin|>", "<|tool▁call▁end|>", }; - builder.add_rule("root", "\"<|tool▁calls▁begin|>\" (" + string_join(tool_rules, " | ") + ")" + (inputs.parallel_tool_calls ? "*" : "") + " space"); + builder.add_rule("root", + "\"<|tool▁calls▁begin|>\"" + " (" +string_join(tool_rules, " | ") + ")" + (inputs.parallel_tool_calls ? "*" : "") + + "\"<|tool▁calls▁end|>\"" + " space"); }, grammar_options); /* Note: we do not feed the thoughts back to the template for a few reasons: