Skip to content

Commit 6aaf4f3

Browse files
committed
change error code to 400
1 parent 6051d69 commit 6aaf4f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/server/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ static json format_error_response(const std::string & message, const enum error_
12271227
break;
12281228
case ERROR_TYPE_EXCEED_CONTEXT_SIZE:
12291229
type_str = "exceed_context_size_error";
1230-
code = 500;
1230+
code = 400;
12311231
break;
12321232
}
12331233
return json {

tools/server/tests/unit/test_chat_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def test_context_size_exceeded():
395395
{"role": "user", "content": "What is the best book"},
396396
] * 100, # make the prompt too long
397397
})
398-
assert res.status_code == 500
398+
assert res.status_code == 400
399399
assert "error" in res.body
400400
assert res.body["error"]["type"] == "exceed_context_size_error"
401401
assert res.body["error"]["n_prompt_tokens"] > 0

0 commit comments

Comments
 (0)