Skip to content

Commit

Permalink
fix(granite chat): Add the <|tool_call|> formatting to the granite te…
Browse files Browse the repository at this point in the history
…mplate

Branch: GraniteToolCallTemplate

Signed-off-by: Gabe Goodhart <[email protected]>
  • Loading branch information
gabe-l-hart committed Nov 5, 2024
1 parent a9e8a9a commit a05f148
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21799,8 +21799,11 @@ static int32_t llama_chat_apply_template_internal(
// IBM Granite template
for (const auto & message : chat) {
std::string role(message->role);
ss << "<|start_of_role|>" << role << "<|end_of_role|>"
<< message->content << "<|end_of_text|>\n";
ss << "<|start_of_role|>" << role << "<|end_of_role|>";
if (role == "assistant_tool_call") {
ss << "<|tool_call|>";
}
ss << message->content << "<|end_of_text|>\n";
}
if (add_ass) {
ss << "<|start_of_role|>assistant<|end_of_role|>\n";
Expand Down

0 comments on commit a05f148

Please sign in to comment.