]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server: handle echo=false on /v1/completions (#12060)
authorrhjdvsgsgks <redacted>
Tue, 25 Feb 2025 11:52:52 +0000 (11:52 +0000)
committerGitHub <redacted>
Tue, 25 Feb 2025 11:52:52 +0000 (12:52 +0100)
examples/server/utils.hpp

index 4867b1582f5339c847e34679e064bb87b2b56f73..6830c2e1a6fd0306856010ae144e9fa839eef001 100644 (file)
@@ -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<std::string> unsupported_params { "best_of", "echo", "suffix" };
+    static const std::vector<std::string> unsupported_params { "best_of", "suffix" };
     for (const auto & param : unsupported_params) {
         if (body.contains(param)) {
             throw std::runtime_error("Unsupported param: " + param);