]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
server : return HTTP 400 if prompt exceeds context length (#16486)
authorRadoslav Gerganov <redacted>
Fri, 10 Oct 2025 14:11:07 +0000 (17:11 +0300)
committerGitHub <redacted>
Fri, 10 Oct 2025 14:11:07 +0000 (16:11 +0200)
commit68ee98ae181a5c83a5cc6261daeee69a1f588c15
tree760d5c153e75544a2bf9bb0d7340471ceed3c496
parentcdb6da468cc33323955a523738d2e1675aeb5e9a
server : return HTTP 400 if prompt exceeds context length (#16486)

In streaming mode when prompt exceeds context length, the server returns
HTTP 200 status code with a JSON error in the body.  This is very
confusing and inconsistent with all other inference engines which return
HTTP 4xx error in this case.

This patch fixes this problem and makes the server return HTTP 400 in
such cases.
tools/server/server.cpp
tools/server/tests/unit/test_chat_completion.py
tools/server/tests/utils.py