From 99ff17556284d684693821d169cd35059a82b6a9 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Fri, 22 Dec 2023 13:41:06 -0500 Subject: [PATCH] Check if completion_tokens is none in error handler. --- llama_cpp/server/errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_cpp/server/errors.py b/llama_cpp/server/errors.py index febe3e3..9d3d355 100644 --- a/llama_cpp/server/errors.py +++ b/llama_cpp/server/errors.py @@ -72,7 +72,7 @@ class ErrorResponseFormatters: return 400, ErrorResponse( message=message.format( context_window, - completion_tokens + prompt_tokens, + (completion_tokens or 0) + prompt_tokens, prompt_tokens, completion_tokens, ), # type: ignore