]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : allow setting `--reverse-prompt` arg (#14799)
authorMolly Sophia <redacted>
Tue, 22 Jul 2025 01:24:22 +0000 (09:24 +0800)
committerGitHub <redacted>
Tue, 22 Jul 2025 01:24:22 +0000 (09:24 +0800)
Signed-off-by: Molly Sophia <redacted>
common/arg.cpp
tools/server/server.cpp

index c1151f51da17b380acf1392b1330e60627196d05..80f965cc731f2579341c126445e7a0516f5b8bbd 100644 (file)
@@ -1612,7 +1612,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
         [](common_params & params, const std::string & value) {
             params.antiprompt.emplace_back(value);
         }
-    ).set_examples({LLAMA_EXAMPLE_MAIN}));
+    ).set_examples({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_SERVER}));
     add_opt(common_arg(
         {"-sp", "--special"},
         string_format("special tokens output enabled (default: %s)", params.special ? "true" : "false"),
index 256a2928b826cfd4e5815a6b1fd193c03a71de8a..022b5d0b310340044bfa3e3233d7700cfa83246f 100644 (file)
@@ -253,6 +253,7 @@ struct server_task {
         defaults.sampling    = params_base.sampling;
         defaults.speculative = params_base.speculative;
         defaults.n_keep      = params_base.n_keep;
+        defaults.antiprompt  = params_base.antiprompt;
 
         // enabling this will output extra debug information in the HTTP responses from the server
         params.verbose           = params_base.verbosity > 9;
@@ -490,6 +491,10 @@ struct server_task {
                     }
                 }
             }
+            // set reverse prompt from cli args if not set in the request
+            if (params.antiprompt.empty()) {
+                params.antiprompt = defaults.antiprompt;
+            }
         }
 
         {