Skip to content

Commit c057efb

Browse files
rhjdvsgsgksmglambda
authored andcommitted
server: handle echo=false on /v1/completions (ggml-org#12060)
1 parent 599fa17 commit c057efb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/server/utils.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,13 @@ static json oaicompat_completion_params_parse(const json & body) {
521521
throw std::runtime_error("Only one completion choice is allowed");
522522
}
523523

524+
// Handle "echo" field
525+
if (json_value(body, "echo", false)) {
526+
throw std::runtime_error("Only no echo is supported");
527+
}
528+
524529
// Params supported by OAI but unsupported by llama.cpp
525-
static const std::vector<std::string> unsupported_params { "best_of", "echo", "suffix" };
530+
static const std::vector<std::string> unsupported_params { "best_of", "suffix" };
526531
for (const auto & param : unsupported_params) {
527532
if (body.contains(param)) {
528533
throw std::runtime_error("Unsupported param: " + param);

0 commit comments

Comments
 (0)