Views
No views yet
pip3 install -r requirements.txt.env file.example.env template into .envcp example.env .env.env file.MODEL_TYPE: supports LlamaCpp or GPT4All
PERSIST_DIRECTORY: is the folder you want your vectorstore in
MODEL_PATH: Path to your GPT4All or LlamaCpp supported LLM
MODEL_N_CTX: Maximum token limit for the LLM model
MODEL_N_BATCH: Number of tokens in the prompt that are fed into the model at a time. Optimal value differs a lot depending on the model (8 works well for GPT4All, and 1024 is better for LlamaCpp)
EMBEDDINGS_MODEL_NAME: SentenceTransformers embeddings model name (see https://www.sbert.net/docs/pretrained_models.html)
TARGET_SOURCE_CHUNKS: The amount of chunks (sources) that will be used to answer a questionlangchain loads the SentenceTransformers embeddings, the first time you run the script it will require internet connection to download the embeddings model itself.source_documents directory.csv: CSV,.docx: Word Document,.doc: Word Document,.enex: EverNote,.eml: Email,.epub: EPub,.html: HTML File,.md: Markdown,.msg: Outlook Message,.odt: Open Document Text,.pdf: Portable Document Format (PDF),.pptx : PowerPoint Document,.ppt : PowerPoint Document,.txt: Text file (UTF-8),python ingest.py1Creating new vectorstore
2Loading documents from source_documents
3Loading new documents: 100%|██████████████████████| 1/1 [00:01<00:00, 1.73s/it]
4Loaded 1 new documents from source_documents
5Split into 90 chunks of text (max. 500 tokens each)
6Creating embeddings. May take some minutes...
7Using embedded DuckDB with persistence: data will be stored in: db
8Ingestion complete! You can now run privateGPT.py to query your documentsdb folder containing the local vectorstore. Will take 20-30 seconds per document, depending on the size of the document.
You can ingest as many documents as you want, and all will be accumulated in the local embeddings database.
If you want to start from an empty database, delete the db folder.python privateGPT.py> Enter a query:exit to finish the script.python privateGPT.py --help in your terminal.LangChain you can run the entire pipeline locally, without any data leaving your environment, and with reasonable performance.ingest.py uses LangChain tools to parse the document and create embeddings locally using HuggingFaceEmbeddings (SentenceTransformers). It then stores the result in a local vector database using Chroma vector store.privateGPT.py uses a local LLM based on GPT4All-J or LlamaCpp to understand questions and create answers. The context for the answers is extracted from the local vector store using a similarity search to locate the right piece of context from the docs.GPT4All-J wrapper was introduced in LangChain 0.0.162.