Best answer

How to Upload PDF to ChatGPT for Analysis?


Userlevel 1
Badge +1

I am trying to build a ZAP that takes a PDF document that is stored in Knack and uploads it to ChatGPT for analysis. I am able to get ChatGPT to accept the conversation and PDF, however, I get an error back that says: I have located the PDF you mentioned, titled "testpdf.pdf", but I was unable to directly access its content due to the current setup not supporting direct content retrieval from PDFs.

All I need to do is upload a PDF and ask ChatGPT to analyze the rules in the document. When I do so using ChatGPT directly, it works perfectly. However, when I try to send via Zapier, ChatGPT cannot read the PDF. Is there another way to send the PDF? Am I doing it wrong? 

I am using the Conversation with Assistant in ChatGPT step with the following settings:

 

icon

Best answer by smccarthy956 4 May 2024, 05:54

View original

8 replies

Can you screenshot the error? there shouldn't be reason why it shouldn’t analyze your pdf!

Userlevel 1
Badge +1

Here is the error. I am guessing Zapier is not handing off the PDF properly to ChatGPT since it’s trying to pull it from the database. I would assume everyone would want this type of functionality, otherwise, it’s just easier and cheaper to write an API. 

The only other option I can think is to have the ZAP save the PDF to a drive and then upload it but, again, it gets so complex and expensive might as well just write the API. I was really hoping I could upload a PDF to Knack, hand it off to ChatGPT for analysis and record the results in the database. This seems so simple.

Error:

 

What database are you pulling from? That is a good question because all PDF handlers I’ve used I’ve had to upload to it.

Userlevel 1
Badge +1

Knack. 

Knack. 

Gotcha! never used it before. I’ll see if I can’t try it myself. I suspect you could be on to something.

Userlevel 1
Badge +1

I figured it out. You have to upload the PDF in a separate step and then link a conversation step back to the PDF file link from chatgpt. I have it working. 

Userlevel 1
Badge +1

“This post has been edited by a moderator to remove personal information. Please remember that this is a public forum and to remove any sensitive information prior to posting.”

I am going to document this because I see a lot of people trying to figure out how to do this with very few answers. This is a workflow to use Knack to send a PDF to ChatGPT and get a response. I have seen people do this and make it overly complicated when it doesn’t need to be. 

One caveat with this method is the PDF has to contain OCR text embedded for ChatGPT to be able to read it but it’s really easy to add an additional step with Zapier or a PDF tool to scan and add the OCR text before or during the process. 

I watched a video of a guy who broke up the PDF into text and ended up with like 20 Zapier steps which will end up costing you a small fortune to run and I was having a hard time following it. This is the easiest most straightforward way to accomplish this.

The best part is you can build an upload form in Knack so the user can upload the PDF in Knack and then as soon as Zapier sees it as a new record, it kicks off the ChatGPT process. I have the app working and it works amazing. I have been trying to do this for years before AI existed and it was not possible. Now it is. 

  1. My trigger is NEW RECORD IN KNACK - Step 1
    1. Then UPLOAD FILE IN CHATGPT. Use the PDF FILE URL as the file upload variable:

    2. When the UPLOAD FILE IN CHATGPT step uploads the file, it gets assigned a FILE ID by ChatGPT. You then create a step CONVERSATION WITH ASSISTANT IN CHATGPT with the following parameters. Notice that the existing file field is filled out with the ID: (File ID). With this step, it will tell ChatGPT to reference the uploaded file from the UPLOAD FILE step and then send your message in to analyze the file. With this method, you don’t have to break up the PDF into text or even worry about memory keys:

    3. Finally, I create a step to update the record in Knack with the results from ChatGPT. Please notice how I am linking the record using the search value of Client Number and I am adding the full response from ChatGPT to the table. If you only want portions of what ChatGPT sent, you can use the reformat text function in Knack or use Zapier to do so. I prefer doing it in Knack as you don’t incur another step charge in Zapier:

    4. Done

I hope you find this useful. I got sick of looking at demos that made it complicated. It’s very straightforward once you figure out how to configure the steps. 

Let me know if you need any help. 

 

Userlevel 7
Badge +11

Awesome work, @smccarthy956! 🎉
 

Thank you so much for sharing details of the solution you implemented with the rest of the Community here. We really appreciate you taking the time to do that. I’m sure there will be lots of folks here that will find it very helpful! 🤗

Sounds like you’re all set for now but please do reach out in the Community again if there’s anything else we can help with. In the meantime, happy Zapping! ⚡

Reply