json: don't complain about unknown format type in server if unset
This commit is contained in:
parent
e7de6433cb
commit
02e3bde6b4
1 changed files with 6 additions and 4 deletions
|
@ -378,12 +378,14 @@ static json oaicompat_completion_params_parse(
|
||||||
|
|
||||||
if (body.contains("response_format")) {
|
if (body.contains("response_format")) {
|
||||||
auto response_format = json_value(body, "response_format", json::object());
|
auto response_format = json_value(body, "response_format", json::object());
|
||||||
if (response_format.contains("type") && response_format["type"] == "json_object") {
|
if (response_format.contains("type")) {
|
||||||
|
if (response_format["type"] == "json_object") {
|
||||||
llama_params["json_schema"] = json_value(response_format, "schema", json::object());
|
llama_params["json_schema"] = json_value(response_format, "schema", json::object());
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("response_format type not supported: " + response_format["type"].dump());
|
throw std::runtime_error("response_format type not supported: " + response_format["type"].dump());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle 'stop' field
|
// Handle 'stop' field
|
||||||
if (body.contains("stop") && body["stop"].is_string()) {
|
if (body.contains("stop") && body["stop"].is_string()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue