Skip to content

Commit

Permalink
server : fix OpenAI API stop field to be optional
Browse files Browse the repository at this point in the history
(cherry picked from commit Mozilla-Ocho/llamafile@e8c92bc)
  • Loading branch information
Mardak committed Dec 2, 2023
1 parent 5a7d312 commit 502bb38
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2410,9 +2410,7 @@ json oaicompat_completion_params_parse(
}

// Handle 'stop' field
if (body["stop"].is_null()) {
llama_params["stop"] = json::array({});
} else if (body["stop"].is_string()) {
if (body.contains("stop") && body["stop"].is_string()) {
llama_params["stop"] = json::array({body["stop"].get<std::string>()});
} else {
llama_params["stop"] = json_value(body, "stop", json::array());
Expand Down

0 comments on commit 502bb38

Please sign in to comment.