This mini-project involves a combination of OpenAI
, LangChain
and Facebook AI Similarity Search (FAISS)
to be able to talk to any PDF of your choice.
OpenAI
is mainly used for its embeddings model.
LangChain
is the main library which helps in ease of question-answering the "PDF" as it is a wrapper which enables us to embed the PDF, store in a vector database, connects to FAISS
to help with similarity search whenever a new query is sent to our custom chatbot.
In order to use the code in script.ipynb
, you will need to make a .env
file with OPEN_API_KEY key having the value of API key from your account on OpenAI.
Make sure to clone the repo on your machine before starting:
git clone https://github.com/tushar2407/talk_to_pdf.git
cd talk_to_pdf
Let's dive into the tutorial on talking to PDF of your choice. First, create a virtual environment using the below command:
virtualenv venv
Next, activate your venv virtual environment:
# for Linux/Mac
source venv/bin/activate
# for Windows
venv\Scripts\activate
Now, install all the required packages:
pip install -r requirements.txt
Lastly, create a .env
file with the following format:
OPENAI_API_KEY="..."
In the file, replace "..." with your OpenAI's API key.
With the above steps, you are all set to run script.ipynb
without any error.
๐จ Caution: Make sure to select your Jupyter Notebook's kernel as your current virtual environment.
- How to Build a Personalized PDF Chat Bot with Conversational Memory: https://medium.com/@avra42/how-to-build-a-personalized-pdf-chat-bot-with-conversational-memory-965280c160f8
- How To Build a ChatBot to Chat With Your PDF: https://blog.gopenai.com/how-to-build-a-chatbot-to-chat-with-your-pdf-9abb9beaf0c4
- How to Build a PDF Chatbot with Streamlit and LangChain: https://medium.com/@krishankantsinghal/building-a-pdf-chatbot-with-streamlit-and-langchain-ed6c567ce6fe