tool-call: ensure we don't return content when there are tool calls / warn
This commit is contained in:
parent
812544ab8b
commit
d44eb95c67
1 changed files with 8 additions and 0 deletions
|
@ -134,6 +134,14 @@ static common_chat_msg parse_json_tool_calls(
|
||||||
it = match.suffix().first;
|
it = match.suffix().first;
|
||||||
result.tool_calls.push_back({name, arguments.is_string() ? arguments.get<std::string>() : arguments.dump(), /* id= */ ""});
|
result.tool_calls.push_back({name, arguments.is_string() ? arguments.get<std::string>() : 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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue