Skip to content

Commit

Permalink
Make OpenAI API stop field optional (#36)
Browse files Browse the repository at this point in the history
Fixes #30
  • Loading branch information
Mardak authored Dec 2, 2023
1 parent ccc377e commit e8c92bc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions llama.cpp/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2400,9 +2400,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 e8c92bc

Please sign in to comment.