From: rhjdvsgsgks Date: Tue, 25 Feb 2025 11:52:52 +0000 (+0000) Subject: server: handle echo=false on /v1/completions (#12060) X-Git-Tag: upstream/0.0.4853~76 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=401af80b546005a06854827b732e3b46979ae028;p=pkg%2Fggml%2Fsources%2Fllama.cpp server: handle echo=false on /v1/completions (#12060) --- diff --git a/examples/server/utils.hpp b/examples/server/utils.hpp index 4867b158..6830c2e1 100644 --- a/examples/server/utils.hpp +++ b/examples/server/utils.hpp @@ -521,8 +521,13 @@ static json oaicompat_completion_params_parse(const json & body) { throw std::runtime_error("Only one completion choice is allowed"); } + // Handle "echo" field + if (json_value(body, "echo", false)) { + throw std::runtime_error("Only no echo is supported"); + } + // Params supported by OAI but unsupported by llama.cpp - static const std::vector unsupported_params { "best_of", "echo", "suffix" }; + static const std::vector unsupported_params { "best_of", "suffix" }; for (const auto & param : unsupported_params) { if (body.contains(param)) { throw std::runtime_error("Unsupported param: " + param);