-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
context_length_exceeded
when generating title
#377
Comments
I am encountering the same error. |
Max tokens is a property of each model, but isn't published through the API. I've asked them to add that openai/openai-python#448 |
Also I think that the max_tokens should be the maximum model token (e.g. 16384 for gpt-3.5-turbo-16k) minus the previous messages length, minus some more safe "margin" tokens. example: Unfortunately doing so will result in an error, so it's usually better to set 1% or 2% less tokens for max_tokens (I'd send 7300 for the example above). |
I'm confused. It's already implemented in the api: https://platform.openai.com/docs/api-reference/chat/create#chat/create-max_tokens I could copy the request from the browser inspect network tab (in curl format), set the max_tokens and run it in the cli terminal. Looks like it's working. I must be missing something... |
Ah, that's the maximum number of tokens to generate, not the maximum supported by the model. (Which I guess would actually be called
Context length VS Max token VS Maximum length When BetterChatGPT is trying to auto-generate a title, it's feeding more tokens to the model than the model supports, producing this error.
(Though it is confusingly called "Max tokens" in the model index table.) |
It is a bit confusing indeed but the As I said it should probably be 1% or 2% less than that to avoid errors (I tried with a precise number and it gave me errors anyway) So in summary... this parameter varies from call to call (i.e. the maximum range of the slider, should become smaller and smaller each time we send a request and get a response) |
Fix ztjhz#377 crudely
Fix ztjhz#377 crudely
Crude fix for ztjhz#377 Ideally would be based on tokens, not characters.
This is fixed in my fork. unfortunately, I fixed it after fixing a lot more stuff to do with model context and max tokens (and detaching fork from parent), so I can't easily make a diff., but feel free to try to steal my implementation. |
Either use the 16k model to generate the title, or just truncate the input (which should be good enough for generating a title)
The text was updated successfully, but these errors were encountered: