From caed1ef76fbc6739fb387fbfd63117af79afc9b4 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Fri, 31 Jan 2025 09:28:23 +0000 Subject: [PATCH] sync: minja (tool call name optional https://github.com/google/minja/pull/36) --- common/chat-template.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/chat-template.hpp b/common/chat-template.hpp index 75ba5d938..58e119a3b 100644 --- a/common/chat-template.hpp +++ b/common/chat-template.hpp @@ -283,10 +283,12 @@ class chat_template { message["role"] = "user"; auto obj = json { {"tool_response", { - {"tool", message.at("name")}, {"content", message.at("content")}, }}, }; + if (message.contains("name")) { + obj["tool_response"]["name"] = message.at("name"); + } if (message.contains("tool_call_id")) { obj["tool_response"]["tool_call_id"] = message.at("tool_call_id"); }