AI Tools #PrivateGPT#local AI#document chat

PrivateGPT: Chat With Your Documents Locally

Set up PrivateGPT for local document Q&A with installation, PDF ingestion, embedding model selection, and AnythingLLM comparison.

7 min read

Uploading confidential documents to ChatGPT or Claude raises real questions about data privacy, especially when those documents contain client data, internal financials, or proprietary research. PrivateGPT is an open-source application that lets you chat with your documents entirely on your own hardware — no internet connection required once set up, no data sent to external servers, and no per-query API costs.

This guide covers installation, the document formats it handles, how to ingest PDFs and Word documents, how to choose an embedding model, and how PrivateGPT stacks up against its main alternative, AnythingLLM.

How PrivateGPT Works

PrivateGPT implements a retrieval-augmented generation (RAG) pipeline entirely locally:

  1. You ingest documents into a local vector store (ChromaDB by default).
  2. Your question is converted to a vector embedding using a local embedding model.
  3. The embedding is used to retrieve the most semantically relevant document chunks.
  4. Those chunks are injected as context into a prompt sent to a local LLM.
  5. The LLM answers based on that context.

The critical difference from cloud-based RAG tools: both the embedding step and the generation step happen on your machine. Nothing leaves.

Installation

PrivateGPT requires Python 3.11 and Poetry for dependency management.

# Clone the repository
git clone https://github.com/zylon-ai/private-gpt
cd private-gpt

# Install Poetry if you don't have it
pip install poetry

# Install dependencies (CPU-only profile)
poetry install --extras "ui llms-ollama embeddings-ollama vector-stores-qdrant"

# Or for a GPU-accelerated setup with llama.cpp
poetry install --extras "ui llms-llama-cpp embeddings-huggingface vector-stores-chroma"

PrivateGPT has a modular extras system — you compose your installation by selecting the LLM backend, embedding provider, and vector store you want.

Quick Start with Ollama

The easiest setup uses Ollama for both inference and embeddings. Install Ollama first, then pull the required models:

ollama pull llama3:8b           # LLM for generation
ollama pull nomic-embed-text    # Embedding model

Configure PrivateGPT by editing settings-ollama.yaml:

llm:
  mode: ollama
  max_new_tokens: 512
  context_window: 3900

ollama:
  llm_model: llama3:8b
  embedding_model: nomic-embed-text
  api_base: http://localhost:11434
  keep_alive: 5m
  tfs_z: 1.0
  num_predict: 512

Launch:

PGPT_PROFILES=ollama make run

The web UI opens at http://localhost:8001.

Supported Document Formats

PrivateGPT handles a broad range of file types out of the box:

FormatExtensionNotes
PDF.pdfText extraction; scanned PDFs need OCR pre-processing
Word.docx, .docFull paragraph and table extraction
Text.txt, .mdDirect ingestion
CSV.csvEach row treated as a document chunk
HTML.htmlTag stripping applied
EPUB.epubE-book chapter chunking
PowerPoint.pptxSlide text extracted

Scanned PDFs (image-based, not text-based) require OCR pre-processing before ingestion. Run them through tesseract or Adobe Acrobat first to produce text-extractable PDFs.

Ingesting PDFs and Word Documents

Via the Web UI

  1. Open http://localhost:8001.
  2. Click Upload File(s) in the left panel.
  3. Select one or more files — PDFs and .docx files are accepted directly.
  4. PrivateGPT chunks the documents, generates embeddings, and stores them in the vector database.
  5. A success indicator appears when ingestion completes.

Via the API

PrivateGPT exposes a REST API for programmatic ingestion:

# Ingest a single file
curl -X POST http://localhost:8001/v1/ingest/file \
  -H "Content-Type: multipart/form-data" \
  -F "file=@/path/to/your/document.pdf"

# List ingested documents
curl http://localhost:8001/v1/ingest/list

# Delete a document by ID
curl -X DELETE http://localhost:8001/v1/ingest/YOUR_DOC_ID

Bulk Ingestion from a Folder

Place files in the source_documents/ directory and run:

poetry run python scripts/ingest_folder.py

This recursively processes all supported files in the folder — useful for initial bulk ingestion of a document archive.

Choosing an Embedding Model

The embedding model determines how well semantic search works. A poor embedding model means the retrieval step surfaces the wrong chunks, and the LLM cannot answer accurately regardless of its own quality.

ModelSizeSpeedQuality
nomic-embed-text (via Ollama)274 MBFastGood
all-MiniLM-L6-v2 (HuggingFace)22 MBVery fastModerate
BAAI/bge-large-en-v1.5 (HuggingFace)1.3 GBModerateExcellent
text-embedding-3-small (OpenAI API)CloudFastExcellent

For a fully local setup, nomic-embed-text via Ollama is the practical choice — it is easy to set up and delivers strong retrieval quality. If you can tolerate a larger download and want the best local retrieval accuracy, BAAI/bge-large-en-v1.5 is worth the extra storage.

To use a HuggingFace embedding model, switch the profile:

embedding:
  mode: huggingface
  
huggingface:
  embedding_hf_model_name: BAAI/bge-large-en-v1.5

Querying Your Documents

Once documents are ingested, select Query Documents mode in the web UI (as opposed to LLM Chat mode, which ignores your documents and just chats with the model).

The query UI shows retrieved source chunks below the answer, with citations indicating which document and page the information came from. This transparency is one of PrivateGPT’s strengths — you can verify that the answer is grounded in your documents rather than model hallucination.

PrivateGPT vs AnythingLLM

Both tools solve the same core problem, but with different priorities:

FeaturePrivateGPTAnythingLLM
Setup difficultyModerate (Poetry, profiles)Easy (Docker or installer)
UI qualityFunctional, minimalPolished, feature-rich
Multi-workspaceNoYes
Web scraping ingestionNoYes
Agent toolsBasicAdvanced (web search, etc.)
APIFull REST APIFull REST API
Performance tuningExtensive configModerate config
Cloud LLM supportYes (OpenAI, etc.)Yes
Fully local capableYesYes

Choose PrivateGPT if you want a hackable, API-first tool with deep configuration options and are comfortable with a code-level setup. Choose AnythingLLM if you want a polished UI, multi-workspace document organization, and a Docker-based setup that non-developers can manage.

For teams with sensitive documents and a technical operator available to maintain it, PrivateGPT’s transparency and configurability make it the more trustworthy choice for serious deployments.

#privacy #RAG #document chat #local AI #PrivateGPT