#forum question PDF API

1 messages · Page 1 of 1 (latest)

deep jewel
#

hi

how to can attach pdf to chat conversition via gpt API ?

i can upload pdf file via API but i dont know how to attachment the pdf file on gpt conversion via chat complete chat

soft roseBOT
#

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

#

Based on the information provided in the extracts, you can upload a file using the OpenAI API as follows:

from openai import OpenAI
client = OpenAI()

file = client.files.create(
  file=open("myfile.pdf", "rb"),
  purpose="assistant"
)

(Source: Forum Post: Upload file from user in assistant api custom gpt thread > Official Answer (https://community.openai.com/t/556937))

However, the extracts do not provide a clear method for attaching the uploaded PDF file to a GPT-3 chat conversation. One user in the forum posts suggested specifying that it's a PDF in the message content, but it's not clear how this is done (Forum Post: Adding PDF in the assistant API input > Official Answer (https://community.openai.com/t/502999)).

Unfortunately, without more information or examples, it's not possible to provide a confident answer on how to attach the uploaded PDF file to a GPT-3 chat conversation via the API. I recommend checking the OpenAI API documentation (https://platform.openai.com/docs) or the OpenAI community forum (https://community.openai.com) for more detailed information or examples.

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

#

@deep jewel kapa.ai is still learning and improving, please let us know how it did by reacting below