Skip to content

Commit 189300f

Browse files
authored
server: handle echo on /v1/completions
1 parent 34a846b commit 189300f

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
@@ -520,9 +520,14 @@ static json oaicompat_completion_params_parse(const json & body) {
520520
if (n_choices != 1) {
521521
throw std::runtime_error("Only one completion choice is allowed");
522522
}
523+
524+
// Handle "echo" field
525+
if (json_value(body, "echo", false)) {
526+
throw std::runtime_error("Only no echo is supported");
527+
}
523528

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)