Skip to content

Commit 782b6c2

Browse files
gabe-l-hartarthw
authored andcommitted
llama : add <|tool_call|> formatting to Granite template (ggml-org#10177)
Branch: GraniteToolCallTemplate Signed-off-by: Gabe Goodhart <[email protected]>
1 parent 6aaed11 commit 782b6c2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/llama.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21808,8 +21808,11 @@ static int32_t llama_chat_apply_template_internal(
2180821808
// IBM Granite template
2180921809
for (const auto & message : chat) {
2181021810
std::string role(message->role);
21811-
ss << "<|start_of_role|>" << role << "<|end_of_role|>"
21812-
<< message->content << "<|end_of_text|>\n";
21811+
ss << "<|start_of_role|>" << role << "<|end_of_role|>";
21812+
if (role == "assistant_tool_call") {
21813+
ss << "<|tool_call|>";
21814+
}
21815+
ss << message->content << "<|end_of_text|>\n";
2181321816
}
2181421817
if (add_ass) {
2181521818
ss << "<|start_of_role|>assistant<|end_of_role|>\n";

0 commit comments

Comments
 (0)