Summarize PDFs through API

It looks like it’s not possible to upload a PDF through the API to get a summary, just like it’s done in the web interface where I can drag and drop a PDF and ask GPT4 to summarize it.
The alternative is to use the assistants API to upload a PDF. However, this seems like a workaround, I just need GPT4 to summarize the PDF once and then I won’t need it anymore.
Does it make sense to upload the PDF to assistant, ask it to summarize it, and delete the PDF from assistant right away?

Is there any other alternative to do a one time summary?

2 Likes

Hey there and welcome to the community!

Yes, no one is going to complain about removing data after its necessary use. It’s a good way to stay efficient!

Speaking of efficiency, yes the API calls take a little more effort than ChatGPT, but many of us enjoy exploring what you can do with the APIs that aren’t something so easily available on the web UI :slightly_smiling_face:.

You would need to use one of the assistant tools to provide it extra files to analyze. There are cookbooks for this if you need it. But in terms of pure simplicity, ChatGPT is still going to be simpler here.

1 Like

One thing I’ll recommend is to stop working with PDFs with the models. Do your own conversion to text first and send the model the raw text.

The main reasons I recommend this are,

  1. You know exactly what the model is getting
  2. You can control exactly what the model is getting.
6 Likes

The beauty of that approach is also that you are by no means restricted to just feeding the content of one document in your API call. There may be instances when you want to combine content from multiple files, possibly in different formats, in a single API call.

By just adding a pre-processing step where you extract the content you can easily achieve that.

1 Like

As mentioned above you can pre process the document. You can lookout some tutorial on web it is not that diffcult.