8000 Check if completion_tokens is none in error handler. · jmformenti/llama-cpp-python@99ff175 · GitHub
[go: up one dir, main page]

Skip to content

Commit 99ff175

Browse files
committed
Check if completion_tokens is none in error handler.
1 parent 12b7f2f commit 99ff175

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llama_cpp/server/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def context_length_exceeded(
7272
return 400, ErrorResponse(
7373
message=message.format(
7474
context_window,
75-
completion_tokens + prompt_tokens,
75+
(completion_tokens or 0) + prompt_tokens,
7676
prompt_tokens,
7777
completion_tokens,
7878
), # type: ignore

0 commit comments

Comments
 (0)
0