How I Built a Private ChatGPT on My Own Documents Using RAGFlow
I didn't want my company's confidential documents living on OpenAI's servers. So I built a private, local ChatGPT using RAGFlow — it ingests PDFs, contracts, and wikis, then lets me chat with them. Here's the complete setup guide.

The Privacy Problem I Had to Solve
Last year, our team started using an AI assistant to answer questions about our internal documentation. Someone uploaded our service contracts, client NDAs, and internal HR policies to a popular AI document tool to "make things easier."
Three days later, I was reading the terms of service of that tool. Our documents were being used to improve their models. I immediately called a meeting, revoked access, and started looking for alternatives that would keep our data completely on-premise.
That search led me to RAGFlow. Two weekends later, I had a fully functional, private ChatGPT-like interface that could answer any question about our internal documentation — running entirely on our own server, with zero data leaving our network. Let me show you exactly how I built it.
What is RAGFlow and How Does it Work?
RAGFlow is an open-source, deep document understanding RAG (Retrieval-Augmented Generation) engine. RAG is the technique where, instead of relying solely on an AI model's training data, you feed it relevant chunks of your own documents at query time so it can answer questions accurately.
What makes RAGFlow stand out from simpler RAG implementations is its document parsing quality. Most RAG tools split documents into fixed-size text chunks, which breaks tables, code blocks, and structured data. RAGFlow uses deep document understanding — it intelligently identifies document structure, preserves table data as structured objects, extracts figures with captions, and handles complex layouts like PDFs with multi-column text.
The result is dramatically better answers when your documents contain tables, technical specs, or structured data. I tested it on a 200-page technical manual with dozens of tables — it answered specific data questions correctly where every other RAG tool I tried failed.
Requirements: What You Need to Self-Host RAGFlow
RAGFlow is more resource-intensive than simpler tools. Here's what you need:
- RAM: Minimum 16 GB. 32 GB recommended for large document sets.
- Storage: 50+ GB for document storage, embeddings, and the vector database.
- CPU: 4+ cores. More cores speed up document processing.
- GPU (Optional): An NVIDIA GPU dramatically speeds up document embedding. CPU-only works but is slower.
- Docker + Docker Compose: The entire stack runs in Docker containers.
- LLM API Key or Local Model: RAGFlow needs an LLM for answering questions. Use OpenAI, Anthropic, or a local Ollama instance.
I run my instance on a dedicated mini-PC with 32 GB RAM, a 1 TB SSD, and an NVIDIA RTX 3060 GPU. Total hardware cost was about $450 used. The running cost is electricity.
Step-by-Step: Installing RAGFlow With Docker Compose
Clone the RAGFlow repository and start the Docker Compose stack:
# Clone the repository
git clone https://github.com/infiniflow/ragflow.git
cd ragflow
# Start all services (this pulls several Docker images - takes 5-10 min first time)
docker compose -f docker/docker-compose.yml up -dRAGFlow runs multiple services: the main API server, an Elasticsearch instance (for document indexing), a MinIO instance (for file storage), a Redis instance (for caching), and a MySQL database. The Docker Compose file manages all of this automatically.
Wait for all containers to start (check with docker compose ps), then open http://localhost (port 80) in your browser. You'll see the RAGFlow login screen. Default credentials are in the RAGFlow documentation — set up your admin account on first login.
Connecting Your LLM: Local and Cloud Options
Before you can chat, you need to connect an LLM. In the RAGFlow settings panel, navigate to Model Providers. For maximum privacy (zero data leaving your server), use Ollama:
- Install Ollama on the same machine (
curl -fsSL https://ollama.com/install.sh | sh). - Pull a model:
ollama run llama3:70b(recommended for RAG quality) orqwen2.5:7bfor faster responses on limited hardware. - In RAGFlow settings, add a new model provider. Select Ollama and enter the base URL:
http://host.docker.internal:11434. - Select this model as your default for chat and embeddings.
If you want better answer quality and don't mind sending query text to a cloud provider (but keeping your raw documents local), you can use the OpenAI or Anthropic API for the LLM while still hosting all documents on your own server.
Uploading Documents and Creating a Knowledge Base
This is where RAGFlow gets exciting. In the dashboard, click Knowledge Base → Create Knowledge Base. Give it a name (e.g., "Company Documents") and configure the chunking strategy.
I recommend starting with the General chunk method for most documents, and switching to Paper for academic/technical PDFs. For spreadsheets and tables, use Table mode — RAGFlow will preserve the tabular structure rather than converting it to flat text.
Upload your documents (PDF, DOCX, TXT, Markdown, Excel, PowerPoint all supported). RAGFlow will process each file: OCR any scanned pages, detect layout structure, split into intelligent chunks, and generate vector embeddings. Processing time varies by document size — a 100-page PDF takes 1-3 minutes.
Once processing is complete, go to Chat → Create Assistant, select your knowledge base, and start chatting. Ask "What does Section 4.2 of the service agreement say about termination?" — and RAGFlow will retrieve the exact section and answer accurately.
Real-World Results: What It's Like After 6 Months
After six months of daily use by our 8-person team, here's the honest assessment:
- Accuracy on structured documents: Excellent. Questions about specific contract clauses, policy numbers, technical specs — near 100% accuracy when the document is in the knowledge base.
- Accuracy on narrative text: Very good. Slightly lower on dense, ambiguous legal or technical prose, but better than any other self-hosted RAG tool I tested.
- Speed: With our RTX 3060 and Llama 3 70B quantized, answers take 5-15 seconds. Acceptable for our use case.
- Setup and maintenance: The initial setup took me about 4 hours including troubleshooting. Maintenance is minimal — occasional Docker image updates.
- Privacy: Our documents never leave our network. The peace of mind alone is worth the setup effort.
The biggest win wasn't even the answers themselves — it was eliminating the "where was that documented?" Slack messages that ate up 30 minutes of someone's day. People now just ask the AI assistant. It either knows the answer or says it doesn't. Either way, it's instant.
FAQ
Can RAGFlow work completely offline?
Yes, if you use a local Ollama model for both chat and embeddings. After the initial Docker image pulls, RAGFlow can run entirely air-gapped with no internet connection required.
What file types does RAGFlow support?
PDF, DOCX, TXT, Markdown, HTML, Excel (XLSX), PowerPoint (PPTX), CSV, EML, and image files with OCR. It handles scanned PDFs via built-in OCR. Most enterprise document formats are covered.
How many documents can it handle?
RAGFlow uses Elasticsearch for document indexing, which scales to millions of documents. For a team knowledge base with hundreds to low thousands of documents, performance will be excellent even on modest hardware.
Is RAGFlow production-ready?
RAGFlow is actively developed and used in production by many organizations. It has authentication, multiple user accounts, and API access. For enterprise use, plan your infrastructure for high availability and add proper backup for the Elasticsearch and MinIO data.
Explore RuView on GitHub
Browse the Rust engine, ESP32 firmware and examples.