Skip to content

Commit

Permalink
Add test that when n_predict=-2 predicted_n==n_ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaangandhi committed Mar 11, 2025
1 parent 7f82025 commit ba1aed3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/server/tests/unit/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,18 @@ def test_cancel_request():
time.sleep(1) # wait for HTTP_POLLING_SECONDS
res = server.make_request("GET", "/slots")
assert res.body[0]["is_processing"] == False


def test_context_window_sized_completion():
global server
server.n_ctx = 16
server.n_predict = -1
server.start()
res = server.make_request("POST", "/completion", data={
"n_predict": -2,
"prompt": "The 50 states in the US are ",
})
assert res.status_code == 200
assert res.body["timings"]["predicted_n"] == server.n_ctx
assert res.body["stop_type"] == "limit"
assert type(res.body["has_new_line"]) == bool

0 comments on commit ba1aed3

Please sign in to comment.