server : add "tokens" output

ggml-ci
This commit is contained in:
Georgi Gerganov 2024-12-16 21:03:24 +02:00
parent 152610eda9
commit 89eaf5036a
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

View file

@ -687,8 +687,6 @@ struct server_task_result_cmpl_partial : server_task_result {
json second_ret = json{
{"choices", json::array({json{{"finish_reason", nullptr},
{"index", 0},
{"delta", json {
{"content", content}}}
}})},
{"created", t},
{"id", oaicompat_cmpl_id},
@ -704,6 +702,7 @@ struct server_task_result_cmpl_partial : server_task_result {
{"delta",
json {
{"content", content},
{"tokens", tokens}
}},
}});
}
@ -1017,6 +1016,7 @@ struct server_slot {
n_prompt_tokens = 0;
last_nl_pos = 0;
generated_text = "";
generated_tokens = {};
has_new_line = false;
truncated = false;
stop = STOP_TYPE_NONE;