#How do I add a PDF attachments to chat gpt 4 while in plugin mode?

1 messages · Page 1 of 1 (latest)

bright nexus
#

As soon as I change the setting from Chat GPT4 to Plugin the button for adding attachments is gone, so I don't know how to add a PDF to the chat. Can someone help me with this?

hoary emberBOT
#

Hi @bright nexus. 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, it appears that there is no direct feature to upload PDF attachments in ChatGPT 4 while in plugin mode. However, there is a workaround mentioned in a forum post (https://community.openai.com/t/565556) where you can use a combination of OpenAI and Langchain to read and ask questions from a PDF file. Here is the code snippet provided:

from langchain.document_loaders import PyPDFLoader
from langchain.llms import OpenAI
from langchain.chains.question_answering import load_qa_chain

# Locate your PDF here.
pdf="<YOUR_PDF_GOES_HERE>"
# Load the PDF
loader = PyPDFLoader(pdf)
documents = loader.load()

api_key = "sk-?????"
llm = OpenAI(openai_api_key=api_key)
chain = load_qa_chain(llm,verbose=True)
question = input("Enter your question here : ")
response = chain.run(input_documents=documents, question=question)
print(response) 

Please replace <YOUR_PDF_GOES_HERE> with the path to your PDF file and sk-????? with your OpenAI API key. This code will load the PDF, and then you can ask questions about the content of the PDF.

Remember, this is a workaround and not a direct feature of ChatGPT 4. For more accurate information, you may want to reach out to OpenAI support or check their official documentation.

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