]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
common : fix gpt-oss content removal (#20745)
authorAldehir Rojas <redacted>
Thu, 19 Mar 2026 10:40:39 +0000 (05:40 -0500)
committerGitHub <redacted>
Thu, 19 Mar 2026 10:40:39 +0000 (11:40 +0100)
common/chat.cpp

index 6a9c0845f2144ba09fad5f0aadf5020f6e719c46..6addf613fabf2ebfd372d87a7bbf6a49188968e6 100644 (file)
@@ -936,7 +936,9 @@ static common_chat_params common_chat_params_init_gpt_oss(const common_chat_temp
     for (auto msg : inputs.messages) {
         if (msg.contains("reasoning_content") && msg.at("reasoning_content").is_string()) {
             msg["thinking"] = msg.at("reasoning_content");
-            msg.erase("content");
+            if (msg.contains("tool_calls") && msg.at("tool_calls").is_array() && !msg.at("tool_calls").empty()) {
+                msg.erase("content");
+            }
         }
         adjusted_messages.push_back(msg);
     }