How to Build chat with PDF assistant

I have an assistant, and I have a button where users can press to add a file to speak to the assistant, then the Assistant will have the current Knowledgebase

AS well as the user’s file

how can I built it, I saw that there is the files API

You would need to incorporate the upload process using your own code by adding the file to the message.

  1. Upload the file and retrieve the returned ID
    https://platform.openai.com/docs/api-reference/files/create

  2. Add the file via ID to the message
    https://platform.openai.com/docs/api-reference/messages/createMessage

Fair warning. There is currently no documented way to view all your current threads and you will be charged $0.20/GB/Day for every file that’s currently being used in a thread. This can leave you very susceptible to script-kiddies blowing up your account.

So you’ll need to be very careful in how you accept these files and basically create your own conversation & file management (Repeating yourself, having 2 sources of truth & rendering a chunk of the Assistants framework useless)

wow thanks for the reply

I am trying to have the users upload their file from another app and then use

Make.com to upload the file to GPT using a files API

then after 1 hour, I make a request to delete the file the user uploaded * this is how I plan on going about the costs

1 Like