Closed kohane27 closed 9 months ago
There is no specific number, this is an issue any time you use the OpenAI API. In general, 3k tokens is enough, but if you need even more, you can switch to gpt-3.5-turbo-16k
to get many more. There's also a gpt-4-32k
if you have access to it with your API key.
Hello there. Hope you're doing well. Thank you for creating
chatgpt.nvim
. The integration chatgpt into neovim is a match made in heaven! However, I encountered the following problem.Description
With the default config like below, chatgpt would stop generating before finishing (i.e., reply gets cut off):
max_tokens = 300
Put the following prompt to chatgpt and it'll stop generating mid-way:
Response:
You can see the response is incomplete.
max_tokens = 4097
Response:
max_tokens = 100
Response:
max_tokens = 3000
If I set
max_tokens = 3000
, I get a complete response.Question
Given gpt-3.5-turbo model's maximum context length is 4097 tokens, what is the maximum or optimal
max_tokens
value I can set to reduce the chance of "reply gets cut off"?I can't simply set
max_tokens = 4197
because I don't know the tokens I need in the messages (i.e.,This model's maximum context length is 4097 tokens. However, you requested 4127 tokens (30 in the messages, 4097 in the completion). Please reduce the length of the messages or completion.
.) I'm currently settingmax_tokens = 3000
but sometimes when the reply is long, it gets cut off too.Any input is much appreciated. Thank you!