Skip to content

Commit a89f75e

Browse files
VoidIsVoidGimling
andauthored
server : handle "logprobs" field with false value (#9871)
Co-authored-by: Gimling <[email protected]>
1 parent 13dca2a commit a89f75e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/server/utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ static json oaicompat_completion_params_parse(
360360

361361
// Handle "logprobs" field
362362
// TODO: The response format of this option is not yet OAI-compatible, but seems like no one really using it; We may need to fix it in the future
363-
if (body.contains("logprobs")) {
363+
if (json_value(body, "logprobs", false)) {
364364
llama_params["n_probs"] = json_value(body, "top_logprobs", 20);
365-
} else if (body.contains("top_logprobs")) {
365+
} else if (body.contains("top_logprobs") && !body.at("top_logprobs").is_null()) {
366366
throw std::runtime_error("top_logprobs requires logprobs to be set to true");
367367
}
368368

0 commit comments

Comments
 (0)