parser: fix structured output bug (#22302)
Some checks failed
Python check requirements.txt / check-requirements (push) Has been cancelled
Python Type-Check / python type-check (push) Has been cancelled
Check Pre-Tokenizer Hashes / pre-tokenizer-hashes (push) Has been cancelled

* 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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 72 additions and 10 deletions

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());