From a22280cb80793a88639d0b6a827a455b6dbd4b28 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Fri, 31 Jan 2025 09:26:34 +0000 Subject: [PATCH] Don't require tool name in backfill behaviour --- include/minja/chat-template.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/minja/chat-template.hpp b/include/minja/chat-template.hpp index 75ba5d9..58e119a 100644 --- a/include/minja/chat-template.hpp +++ b/include/minja/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"); }