From c06405e10d9749956bcd0d07f862070d8e162d7a Mon Sep 17 00:00:00 2001 From: ZXED Date: Sun, 8 Dec 2024 13:06:23 +0300 Subject: [PATCH] server : return stopping_word in the partial response --- examples/server/server.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 1c21e55aa..9865db243 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -556,6 +556,7 @@ struct server_task_result_cmpl_partial : server_task_result { int32_t n_decoded; int32_t n_prompt_tokens; + std::string stopping_word; stop_type stop = STOP_TYPE_NONE; std::vector probs_output; @@ -586,6 +587,7 @@ struct server_task_result_cmpl_partial : server_task_result { {"index", index}, {"content", content}, {"stop_type", stop_type_to_str(stop)}, + {"stopping_word", stopping_word}, {"stop", is_stop}, {"id_slot", id_slot}, {"tokens_predicted", n_decoded}, @@ -1892,7 +1894,8 @@ struct server_context { res->n_decoded = slot.n_decoded; res->n_prompt_tokens = slot.n_prompt_tokens; - res->stop = slot.stop; + res->stopping_word = slot.stopping_word; + res->stop = slot.stop; res->verbose = slot.params.verbose; res->oaicompat = slot.params.oaicompat;