Skip to content

Commit 5a1d089

Browse files
aldehirxiukeding
authored andcommitted
common : fix gpt-oss content removal (ggml-org#20745)
1 parent c51440c commit 5a1d089

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

common/chat.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,9 @@ static common_chat_params common_chat_params_init_gpt_oss(const common_chat_temp
936936
for (auto msg : inputs.messages) {
937937
if (msg.contains("reasoning_content") && msg.at("reasoning_content").is_string()) {
938938
msg["thinking"] = msg.at("reasoning_content");
939-
msg.erase("content");
939+
if (msg.contains("tool_calls") && msg.at("tool_calls").is_array() && !msg.at("tool_calls").empty()) {
940+
msg.erase("content");
941+
}
940942
}
941943
adjusted_messages.push_back(msg);
942944
}

0 commit comments

Comments
 (0)