parser: fix structured output bug (#22302)

* fix very stupid structured output bug

* Things just cannot be too easy.
This commit is contained in:
Piotr Wilkin (ilintar)
2026-04-24 23:19:55 +02:00
committed by GitHub
parent 361fe72acb
commit 0adede866d
2 changed files with 72 additions and 10 deletions
+3 -1
View File
@@ -947,7 +947,9 @@ json oaicompat_chat_params_parse(
json response_format = json_value(body, "response_format", json::object());
std::string response_type = json_value(response_format, "type", std::string());
if (response_type == "json_object") {
json_schema = json_value(response_format, "schema", json::object());
if (response_format.contains("schema") || json_schema.empty()) {
json_schema = json_value(response_format, "schema", json::object());
}
} else if (response_type == "json_schema") {
auto schema_wrapper = json_value(response_format, "json_schema", json::object());
json_schema = json_value(schema_wrapper, "schema", json::object());