diff --git a/common/chat.cpp b/common/chat.cpp index b6e1a87a8..c134ae568 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -134,6 +134,14 @@ static common_chat_msg parse_json_tool_calls( it = match.suffix().first; result.tool_calls.push_back({name, arguments.is_string() ? arguments.get() : arguments.dump(), /* id= */ ""}); } + + if (!result.tool_calls.empty()) { + if (!string_trim(result.content).empty()) { + LOG_WRN("Content found with tool calls: %s", result.content.c_str()); + } + result.content = ""; + result.role = "user"; + } return result; }