#what is the max amount of words/chareters 4o can compute
1 messages · Page 1 of 1 (latest)
Hi @supple vault. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The maximum amount of tokens that GPT-4o can compute is determined by its context window, which is 128,000 tokens. However, it's important to note that the maximum number of tokens that can be generated in a single completion is 4,096 tokens.
In terms of words and characters, it's a bit more complex. A token in English can be as short as one character or as long as one word. As a rough rule of thumb, 1 token is approximately 4 characters or 0.75 words for English text. Therefore, the context window of 128,000 tokens could be approximately 512,000 characters or 96,000 words. However, these are rough estimates and the actual number can vary depending on the specific text.
You can use OpenAI’s tiktoken (https://github.com/openai/tiktoken) Python library to see how many tokens are in a text string without making an API call. Example code can be found in the OpenAI Cookbook’s guide on how to count tokens with tiktoken (https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken).
Sources:
- OpenAI Models Documentation (https://platform.openai.com/docs/models)
- OpenAI Advanced Usage Documentation (https://platform.openai.com/docs/advanced-usage)
- OpenAI Community Post (https://community.openai.com/t/758066)
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@supple vault kapa.ai is still learning and improving, please let us know how it did by reacting below
@brave marsh i gave it a text that is 15k words with 4o mini for context and it said it could not generate a response
Let me check the knowledge base for you. One moment! :books:
The issue you're encountering might be due to the maximum context window of the GPT-4o-mini model, which is 128,000 tokens. If your text of 15,000 words exceeds this limit when tokenized, the model won't be able to process it.
Remember that in English, a token can be as short as one character or as long as one word. So, 15,000 words could potentially be much more than 15,000 tokens.
Additionally, the maximum number of tokens that can be generated in a single completion for GPT-4o-mini is 16,384 tokens. If you're trying to generate more tokens than this limit, you would also encounter an error.
You can use OpenAI’s tiktoken (https://github.com/openai/tiktoken) Python library to see how many tokens are in a text string without making an API call. Example code can be found in the OpenAI Cookbook’s guide on how to count tokens with tiktoken (https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken).
Sources:
- OpenAI Models Documentation (https://platform.openai.com/docs/models)
- OpenAI Advanced Usage Documentation (https://platform.openai.com/docs/advanced-usage)
- OpenAI Community Post (https://community.openai.com/t/758066)