Skip to content

Commit

Permalink
server: Handle "logprobs" field with false value
Browse files Browse the repository at this point in the history
  • Loading branch information
Gimling committed Oct 13, 2024
1 parent 11ac980 commit 077e16f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/server/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static json oaicompat_completion_params_parse(

// Handle "logprobs" field
// 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
if (body.contains("logprobs")) {
if (json_value(body, "logprobs", false)) {
llama_params["n_probs"] = json_value(body, "top_logprobs", 20);
} else if (body.contains("top_logprobs")) {
throw std::runtime_error("top_logprobs requires logprobs to be set to true");
Expand Down

0 comments on commit 077e16f

Please sign in to comment.