28594_usage_tracking
Showing
1 changed file
with
1 additions
and
1 deletions
| ... | @@ -192,7 +192,7 @@ async function runGPTTurbo(req, res) { | ... | @@ -192,7 +192,7 @@ async function runGPTTurbo(req, res) { |
| 192 | let usage = {}; | 192 | let usage = {}; |
| 193 | let enc = null; | 193 | let enc = null; |
| 194 | try { | 194 | try { |
| 195 | enc = encoding_for_model(tiktokenModels.includes(currentModel) ? currentModel : 'gpt-3.5-turbo'); | 195 | enc = encodingForModel(tiktokenModels.includes(currentModel) ? currentModel : 'gpt-3.5-turbo'); |
| 196 | usage.prompt_tokens = (enc.encode(query_prompt)).length; | 196 | usage.prompt_tokens = (enc.encode(query_prompt)).length; |
| 197 | usage.completion_tokens = (enc.encode(input)).length; | 197 | usage.completion_tokens = (enc.encode(input)).length; |
| 198 | usage.total_tokens = usage.prompt_tokens + usage.completion_tokens; | 198 | usage.total_tokens = usage.prompt_tokens + usage.completion_tokens; | ... | ... |
-
Please register or sign in to post a comment