Skip to content

Commit

Permalink
server : remove "tokens" from the OAI endpoint
Browse files Browse the repository at this point in the history
ggml-ci
  • Loading branch information
ggerganov committed Dec 18, 2024
1 parent 5bf29af commit 99cb6be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ struct server_task_result_cmpl_final : server_task_result {
{"index", 0},
{"message", json {
{"content", content},
{"tokens", tokens},
{"role", "assistant"}
}
}}});
Expand Down Expand Up @@ -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},
Expand All @@ -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}
}},
}});
}
Expand Down
4 changes: 2 additions & 2 deletions examples/server/tests/unit/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]


Expand Down

0 comments on commit 99cb6be

Please sign in to comment.