Skip to content

Commit 14d11ec

Browse files
committed
Fixed num_context_tokens always being 0 if the value of max_context_tokens is not exceeded
1 parent 6112bc2 commit 14d11ec

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/openai_ops.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ def messages_within_context_window(
7878
if not removed:
7979
# Fall through and let the OpenAI error handler deal with it
8080
break
81+
else:
82+
num_context_tokens = num_tokens
83+
8184
return messages, num_context_tokens, max_context_tokens
8285

8386

0 commit comments

Comments
 (0)