Skip to content

Commit 7199eb9

Browse files
committed
Add test that when n_predict=-2 predicted_n==n_ctx
1 parent f3fdca7 commit 7199eb9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/server/tests/unit/test_completion.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,18 @@ def test_cancel_request():
426426
time.sleep(1) # wait for HTTP_POLLING_SECONDS
427427
res = server.make_request("GET", "/slots")
428428
assert res.body[0]["is_processing"] == False
429+
430+
431+
def test_context_window_sized_completion():
432+
global server
433+
server.n_ctx = 16
434+
server.n_predict = -1
435+
server.start()
436+
res = server.make_request("POST", "/completion", data={
437+
"n_predict": -2,
438+
"prompt": "The 50 states in the US are ",
439+
})
440+
assert res.status_code == 200
441+
assert res.body["timings"]["predicted_n"] == server.n_ctx
442+
assert res.body["stop_type"] == "limit"
443+
assert type(res.body["has_new_line"]) == bool

0 commit comments

Comments
 (0)