Skip to content

Commit 33e171d

Browse files
authored
server : fix OpenAI API stop field to be optional (#4299)
(cherry picked from commit Mozilla-Ocho/llamafile@e8c92bc)
1 parent 6949b50 commit 33e171d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

examples/server/server.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -2410,9 +2410,7 @@ json oaicompat_completion_params_parse(
24102410
}
24112411

24122412
// Handle 'stop' field
2413-
if (body["stop"].is_null()) {
2414-
llama_params["stop"] = json::array({});
2415-
} else if (body["stop"].is_string()) {
2413+
if (body.contains("stop") && body["stop"].is_string()) {
24162414
llama_params["stop"] = json::array({body["stop"].get<std::string>()});
24172415
} else {
24182416
llama_params["stop"] = json_value(body, "stop", json::array());

0 commit comments

Comments
 (0)