From f73c470980b88dd5ece2c7b381ec9a61b5c5248f Mon Sep 17 00:00:00 2001 From: ngxson Date: Sun, 24 Mar 2024 21:07:33 +0100 Subject: [PATCH] fix empty response_format --- examples/server/utils.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/server/utils.hpp b/examples/server/utils.hpp index f2af3dac7..a1865e73d 100644 --- a/examples/server/utils.hpp +++ b/examples/server/utils.hpp @@ -376,10 +376,10 @@ static json oaicompat_completion_params_parse( // Handle "response_format" field if (body.contains("response_format")) { json response_format = json_value(body, "response_format", json::object()); - std::string response_type = json_value(response_format, "type", std::string("unknown")); + std::string response_type = json_value(response_format, "type", std::string()); if (response_type == "json_object") { llama_params["json_schema"] = json_value(response_format, "schema", json::object()); - } else { + } else if (!response_type.empty()) { throw std::runtime_error("response_format type not supported: " + response_type); } }