I am developing a code, this code is a Flask web application that uses the OpenAI API to answer questions based on a PDF document but I only want it to answer about the document and I don’t want it to go to the internet to search for the answer if it is not in the PDF.
The models provided by the OpenAI API does not have internet access, you won’t have any issues with that
You can use a system prompt with included context like this one:
You are a chatbot designed to provide answers solely based on the context delimited '#' that is provided to you. Do not use external information, opinions, or data. Only rely on the context given in each query to generate your response. If no context is provided, inform the user accordingly.
###
{"Information from pdf"}
###
That should restrict the information provided to only being from the document.