#Can I attach a file to a conversation with a Custom GPT action?

1 messages · Page 1 of 1 (latest)

spice girder
#

I would like to build an action that will make a GET request to a server and fetch a PDF file. I want this PDF file to be attached to a conversation, so that GPT can answer questions about it.

burnt windBOT
#

Hi @spice girder. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Yes, you can attach a file to a conversation with a Custom GPT action. However, there are some specific requirements and limitations you need to be aware of:

  1. The file needs to be converted to a base64 string and formatted in the structure that ChatGPT expects. This can be done using a server-side function, such as an Azure Function in Node.js, as demonstrated in the OpenAI Cookbook example (https://cookbook.openai.com/examples/chatgpt/gpt_actions_library/gpt_action_sharepoint_doc#architecture--example).

  2. The file can be used by GPT as if it had been uploaded directly to the conversation. However, the file size and token count are limited. Each file can be up to 512 MB in size and can contain up to 2,000,000 tokens. You can attach up to 20 files to a GPT, and up to 10 files can be uploaded to a given conversation (OpenAI Community (https://community.openai.com/t/846493), OpenAI Help Article (https://help.openai.com/en/articles/8437071-data-analysis-with-chatgpt#h_0ae0bae1b7)).

  3. If the file is fetched from a third-party API, it needs to meet specific requirements. If the API is not under your control, you may need to deploy your own proxy API to handle the file fetching and conversion (OpenAI Community (https://community.openai.com/t/848948)).

  4. The file can be attached at different levels (Assistant, Thread, or Message level) depending on the use case. If many users will interact with the same Assistant and ask questions, the file should be at the Assistant level. If the file is specific to one user or conversation, it should be at the thread or message level (OpenAI Community (https://community.openai.com/t/630272)).

#

Please note that these are general guidelines and the actual implementation may vary depending on your specific requirements and the capabilities of the GPT model you are using.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: