Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 89d604f

Browse files
server: Fix has_next_line in JSON response (#10818)
* Update server JSON response. * Add unit test to check `has_new_line` JSON response * Remove `has_new_line` unit test changes. * Address code review comment: type check for `has_new_line` in unit test
1 parent e52aba5 commit 89d604f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

examples/server/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ struct server_task_result_cmpl_final : server_task_result {
459459
int32_t n_decoded;
460460
int32_t n_prompt_tokens;
461461
int32_t n_tokens_cached;
462-
int32_t has_new_line;
462+
bool has_new_line;
463463
std::string stopping_word;
464464
stop_type stop = STOP_TYPE_NONE;
465465

examples/server/tests/unit/test_completion.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def test_completion(prompt: str, n_predict: int, re_content: str, n_prompt: int,
2525
assert res.body["timings"]["prompt_n"] == n_prompt
2626
assert res.body["timings"]["predicted_n"] == n_predicted
2727
assert res.body["truncated"] == truncated
28+
assert type(res.body["has_new_line"]) == bool
2829
assert match_regex(re_content, res.body["content"])
2930

3031

@@ -48,6 +49,7 @@ def test_completion_stream(prompt: str, n_predict: int, re_content: str, n_promp
4849
assert data["timings"]["predicted_n"] == n_predicted
4950
assert data["truncated"] == truncated
5051
assert data["stop_type"] == "limit"
52+
assert type(data["has_new_line"]) == bool
5153
assert "generation_settings" in data
5254
assert server.n_predict is not None
5355
assert data["generation_settings"]["n_predict"] == min(n_predict, server.n_predict)

examples/server/utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <vector>
2323
#include <memory>
2424

25-
#define DEFAULT_OAICOMPAT_MODEL "gpt-3.5-turbo-0613"
25+
#define DEFAULT_OAICOMPAT_MODEL "gpt-3.5-turbo"
2626

2727
using json = nlohmann::ordered_json;
2828

0 commit comments

Comments
 (0)