OpenAI tokens and limits
OpenAI tokens and their limits are an important consideration when using the OpenAI Chat API. The API has a limit on the number of tokens that can be processed, including both the prompt and the completion. For example, if the combined tokens in the prompt are 3,000, the completion cannot exceed around 1,000 tokens. It's important to keep track of the token count to avoid exceeding the model's limit. Tokens can include punctuation and spaces.
When using functions as part of the OpenAI chat API, tokens are used in a different way, similar to the system prompt. Declaring functions uses up tokens, and there may be additional interactions with the model when the function is called, which can use up more tokens.
Strategies for continuing a chat "conversation" beyond the token limit will be discussed in future blog posts. It's important to keep in mind that the token limit can be reached quickly if there are multiple embeddings or if functions return large chunks of text.
If you're interested in learning more about chat API usage and best practices, you can check out the OpenAI developer community forum for discussions and resources.