ChatPDF icon indicating copy to clipboard operation
ChatPDF copied to clipboard

This model's maximum context length is 4097 tokens, however you requested 4236 tokens

Open huangxin168 opened this issue 1 year ago • 4 comments

Thanks for you contribution and work! Sometimes I got error like this: openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens, however you requested 4236 tokens (3980 in your prompt; 256 for the completion). Please reduce your prompt; or completion length.

How can I solve this problem?

huangxin168 avatar Jun 29 '23 01:06 huangxin168

This project ignores the fact that PDFs could be quite large and not fit into a single GPT query. What people usually do to workaround this is to make summary of summary of summary recursively, in order to squeeze the original PDF content.

dmikushin avatar Aug 13 '23 10:08 dmikushin

This means that this ChatPDF is quite different from the known app. In the original app, they perform semantic indexing and extract relevant paragraphs to feed them to ChatGPT. Which is way more efficient than sending the whole PDF to ChatGPT.

minoush82 avatar Aug 17 '23 14:08 minoush82

Precisely. But let's appreciate the author's effort to demonstrate the feasibility of GPT by this project. Ultimately, this is a great contribution to rethinking and enriching the services we all use in the daily life.

dmikushin avatar Aug 17 '23 16:08 dmikushin

You can try 16K model, but it will increase the cost. Here is the price list: https://openai.com/pricing

Aincvy avatar Sep 16 '23 01:09 Aincvy