Skip to content

Commit b8deef0

Browse files
authored
llama : add <|tool_call|> formatting to Granite template (#10177)
Branch: GraniteToolCallTemplate Signed-off-by: Gabe Goodhart <[email protected]>
1 parent a9e8a9a commit b8deef0

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
@@ -21799,8 +21799,11 @@ static int32_t llama_chat_apply_template_internal(
2179921799
// IBM Granite template
2180021800
for (const auto & message : chat) {
2180121801
std::string role(message->role);
21802-
ss << "<|start_of_role|>" << role << "<|end_of_role|>"
21803-
<< message->content << "<|end_of_text|>\n";
21802+
ss << "<|start_of_role|>" << role << "<|end_of_role|>";
21803+
if (role == "assistant_tool_call") {
21804+
ss << "<|tool_call|>";
21805+
}
21806+
ss << message->content << "<|end_of_text|>\n";
2180421807
}
2180521808
if (add_ass) {
2180621809
ss << "<|start_of_role|>assistant<|end_of_role|>\n";

0 commit comments

Comments
 (0)