Skip to content

Commit e8c92bc

Browse files
authored
Make OpenAI API stop field optional (#36)
Fixes #30
1 parent ccc377e commit e8c92bc

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llama.cpp/server/server.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,9 +2400,7 @@ json oaicompat_completion_params_parse(
24002400
}
24012401

24022402
// Handle 'stop' field
2403-
if (body["stop"].is_null()) {
2404-
llama_params["stop"] = json::array({});
2405-
} else if (body["stop"].is_string()) {
2403+
if (body.contains("stop") && body["stop"].is_string()) {
24062404
llama_params["stop"] = json::array({body["stop"].get<std::string>()});
24072405
} else {
24082406
llama_params["stop"] = json_value(body, "stop", json::array());

0 commit comments

Comments
 (0)