server : remove "tokens" from the OAI endpoint

ggml-ci
This commit is contained in:
Georgi Gerganov 2024-12-18 10:16:46 +02:00
parent 5bf29af841
commit 99cb6be1d3
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 5 additions and 8 deletions

View file

@ -547,7 +547,6 @@ struct server_task_result_cmpl_final : server_task_result {
{"index", 0},
{"message", json {
{"content", content},
{"tokens", tokens},
{"role", "assistant"}
}
}}});
@ -688,9 +687,8 @@ 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},
{"tokens", tokens}}}
{"delta", json {
{"content", content}}}
}})},
{"created", t},
{"id", oaicompat_cmpl_id},
@ -704,9 +702,8 @@ struct server_task_result_cmpl_partial : server_task_result {
{"finish_reason", nullptr},
{"index", 0},
{"delta",
json{
json {
{"content", content},
{"tokens", tokens}
}},
}});
}

View file

@ -62,8 +62,8 @@ def test_completion_stream(prompt: str, n_predict: int, re_content: str, n_promp
assert data["generation_settings"]["seed"] == server.seed
assert match_regex(re_content, content)
else:
assert len(res.body["tokens"]) > 0
assert all(type(tok) == int for tok in res.body["tokens"])
assert len(data["tokens"]) > 0
assert all(type(tok) == int for tok in data["tokens"])
content += data["content"]