diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index 98d71141c..adc4a3c5a 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -374,7 +374,7 @@ class Base(ABC): if not tol: total_tokens += num_tokens_from_string(resp.choices[0].delta.content) else: - total_tokens += tol + total_tokens = tol finish_reason = resp.choices[0].finish_reason if hasattr(resp.choices[0], "finish_reason") else "" if finish_reason == "length": @@ -410,7 +410,7 @@ class Base(ABC): if not tol: total_tokens += num_tokens_from_string(resp.choices[0].delta.content) else: - total_tokens += tol + total_tokens = tol answer += resp.choices[0].delta.content yield resp.choices[0].delta.content