Skip to content

Commit

Permalink
llama : add <|tool_call|> formatting to Granite template (#10177)
Browse files Browse the repository at this point in the history
Branch: GraniteToolCallTemplate

Signed-off-by: Gabe Goodhart <[email protected]>
  • Loading branch information
gabe-l-hart authored Nov 5, 2024
1 parent a9e8a9a commit b8deef0
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 b8deef0

Please sign in to comment.