quota = countToken(text) + 3 } else { quota = textResponse.Usage.TotalTokens } 2 changes: 2 additions & 0 deletions 2 go.mod Original file line numberDiff line numberDiff line change @@ -25,6 +25,7 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/chen...
however api responds with a different value for prompt tokens from the one we calculated before the submit. my question is it a bug or something else i am missing. packagesample.issue.tokens;importcom.didalgo.gpt3.Encoding;importcom.didalgo.gpt3.GPT3Tokenizer;importorg.junit.jupiter.api.Asser...
openai has built a python library called tiktoken to help businesses estimate the number of tokens in a text string without making an api call. you can thus integrate it into your application’s backend to gauge token usage beforehand. this should help in deciding whether to proceed with the...