Currently, you may interact with documents akin to PDFs using ChatGPT plugins as I showed in a previous article, but that feature is exclusive to ChatGPT plus subscribers.
Today, I’ll show you a free alternative to ChatGPT that may aid you not only interact along with your documents as in the event you’re using ChatGPT but in addition privately and offline, so that you don’t need to worry about data leaks.
This alternative is known as privateGPT and, on this guide, I’ll show you the right way to install it in your computer step-by-step.
Before showing you the steps it is advisable follow to put in privateGPT, here’s a demo of how it really works.
For the test below I’m using a research paper named SMS.pdf (other formats supported are .csv, .docx, .doc, .epub, .ppt, and .txt). On the terminal, I run privateGPT using the command python privateGPT.py
.
Then I can type a prompt similar to we’d do with ChatGPT.
It’s not as fast as ChatGPT, but do not forget that it’s free, offline, and all of your information will probably be 100% private, so let’s give it a try!
In case you’re accustomed to some terminal commands, installing privateGPT will probably be quite simple. If not, just follow each step listed below.
Step 1: Setup privateGPT
Go to this GitHub repo, click on the green button that claims “Code” and replica the link inside.
Now open up a terminal and clone the repo by typing the command git clone
and pasting the link we just copied.
git clone https://github.com/imartinez/privateGPT.git
Note: Be at liberty to create a virtual environment and create an additional folder to nicely organized your files.
Now we must always see a latest folder named privateGPT. We’ve to go to that folder using the cd
command.
cd privateGPT/
Inside that folder, there ought to be a requirements.txt
file. That file incorporates all of the dependencies we now have to put in for privateGPT to work.
Let’s install all of the dependencies inside requirements.txt
using the command below.
pip install -r requirements.txt
After running the command above, it is best to see a bunch of libraries being installed.
Once the installation is completed, we now have to rename the file example.env
to .env
. You possibly can do it manually or using the command below on the terminal.
mv example.env .env
You possibly can edit the content contained in the .env file in the event you want, but in the event you’re following this tutorial I like to recommend you to go away it as is.
Step 2: Download the LLM
Now it’s time to download the LLM. To accomplish that, we now have to go to this GitHub repo again and download the file called ggml-gpt4all-j-v1.3-groovy.bin
(inside “Environment Setup”). The file is about 4GB, so it would take some time to download it.
Then we now have to create a folder named “models” contained in the privateGPT folder and put the LLM we just downloaded contained in the “models” folder.
Finally, be certain that any file you need to analyze with privateGPT is contained in the source_documents folder. All of the supported extensions are listed below:
.csv .docx .doc .enex .eml .epub .html .md .msg .odt .pdf .pptx .ppt .txt
Step 3: Interact along with your documents with privateGPT
Once you set the files you need to interact with contained in the source_documents folder, we now have to load all our documents using the command below.
python ingest.py
After running the command, it is best to see the next image.
Now we are able to start asking inquiries to our document by utilizing the command below.
python privateGPT.py
After some seconds it is best to see the message “Enter a question.” Here’s the query I’ll use for this test:
> Enter a question: write a summary of the paper SMS.pdf
Great! PrivateGPT did a great job summarizing my paper.
Just note that privateGPT just isn’t production ready. The model selection just isn’t optimized for performance, but for privacy.