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}, {"index", 0},
{"message", json { {"message", json {
{"content", content}, {"content", content},
{"tokens", tokens},
{"role", "assistant"} {"role", "assistant"}
} }
}}}); }}});
@ -689,8 +688,7 @@ struct server_task_result_cmpl_partial : server_task_result {
{"choices", json::array({json{{"finish_reason", nullptr}, {"choices", json::array({json{{"finish_reason", nullptr},
{"index", 0}, {"index", 0},
{"delta", json { {"delta", json {
{"content", content}, {"content", content}}}
{"tokens", tokens}}}
}})}, }})},
{"created", t}, {"created", t},
{"id", oaicompat_cmpl_id}, {"id", oaicompat_cmpl_id},
@ -706,7 +704,6 @@ struct server_task_result_cmpl_partial : server_task_result {
{"delta", {"delta",
json { json {
{"content", content}, {"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 data["generation_settings"]["seed"] == server.seed
assert match_regex(re_content, content) assert match_regex(re_content, content)
else: else:
assert len(res.body["tokens"]) > 0 assert len(data["tokens"]) > 0
assert all(type(tok) == int for tok in res.body["tokens"]) assert all(type(tok) == int for tok in data["tokens"])
content += data["content"] content += data["content"]