how can I count prompt tokens? with which tool I can do Tokenizer job?
https://platform.openai.com/tokenizer
An API for accessing new AI models developed by OpenAI
10 messages · Page 1 of 1 (latest)
how can I count prompt tokens? with which tool I can do Tokenizer job?
https://platform.openai.com/tokenizer
An API for accessing new AI models developed by OpenAI
They link a nodejs package you can use for that at the bottom of the page. If you are using python you will want to look for a library called tiktoken
oh tnx
it return this...
The length of that array should be the amount of tokens in the text
oh gotcha
I'll be interested to find out if you get the same figures as are returned from the API. In my experience, the OpenAI tokenizer page and the API use slightly different algorithms. This is especially evident when you have Unicode characters in your prompt.
take a look at this