openai-python
openai-python copied to clipboard
Compute nb of tokens for a prompt
Hi, Is there a way to compute the number of tokens in the prompt before sending a request (in python)? I'd like to avoid the "too many tokens" error by setting max_token to 4097 - nb_tokens(prompt)
Thanks!