Skip to content

Commit 7770d0f

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 e56ba44 commit 7770d0f

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
@@ -21807,8 +21807,11 @@ static int32_t llama_chat_apply_template_internal(
2180721807
// IBM Granite template
2180821808
for (const auto & message : chat) {
2180921809
std::string role(message->role);
21810-
ss << "<|start_of_role|>" << role << "<|end_of_role|>"
21811-
<< message->content << "<|end_of_text|>\n";
21810+
ss << "<|start_of_role|>" << role << "<|end_of_role|>";
21811+
if (role == "assistant_tool_call") {
21812+
ss << "<|tool_call|>";
21813+
}
21814+
ss << message->content << "<|end_of_text|>\n";
2181221815
}
2181321816
if (add_ass) {
2181421817
ss << "<|start_of_role|>assistant<|end_of_role|>\n";

0 commit comments

Comments
 (0)