ai-tools

How to Build a Personal AI Knowledge Base with RAGFlow (2026 Guide)

🛠️

ToolMix

· 9 min read
ragflowknowledge-baserag

RAGFlow Knowledge Base

TL;DR

RAGFlow is an open-source, deep document understanding platform that leverages RAG (Retrieval-Augmented Generation) to let you chat with your documents. Unlike simpler tools, RAGFlow uses advanced document parsing to understand complex layouts — tables, images, multi-column PDFs — and retrieves answers with high precision. This guide walks you through setting up RAGFlow with Docker, uploading documents, configuring chunking strategies, and using the API to integrate AI-powered document search into your own applications.


What Is RAGFlow?

RAGFlow (Retrieval-Augmented Generation Flow) is a deep document question-answering system built on RAG principles. It goes beyond simple text extraction by employing an intelligent document parsing engine called DeepDoc that understands document structure — headers, tables, figures, captions, and page layout.

Key features that distinguish RAGFlow:

  • Deep document understanding — It parses complex PDFs with tables, charts, and mixed column layouts that stump simpler PDF extractors
  • Multiple chunking strategies — Q&A chunking, General chunking, Manual chunking, and Table-aware chunking
  • Multi-model support — Compatible with OpenAI, Claude, DeepSeek, ZhipuAI, Ollama, and any OpenAI-compatible API
  • Grounded citations — Every answer includes citations pointing to the exact document, page, and paragraph it came from
  • Enterprise features — Team collaboration, user management, and RBAC are built in
  • Developer API — Full REST API for programmatic knowledge base management and querying

RAGFlow is particularly strong for use cases involving financial reports, legal documents, research papers, and technical manuals — documents where layout conveys meaning and simple text extraction is not enough.


How RAGFlow Compares to Alternatives

FeatureRAGFlowDifyprivateGPTChatPDF
Document parsing qualityExcellent (DeepDoc)Good (standard PDF parser)Basic (LangChain loader)Basic (proprietary)
Table understandingYes, nativeLimitedNoNo
Chunking strategies4 built-in methodsGeneral + Parent-ChildBasic recursiveNot configurable
Multi-column PDF handlingExcellentFairPoorPoor
Self-hostingYes (Docker)Yes (Docker)Yes (Python)No (cloud only)
LLM flexibilityOpenAI, Claude, Ollama, ZhipuAI, DeepSeekOpenAI, Claude, Ollama, many othersAny via LangChainFixed provider
API accessFull REST APIFull REST APILimitedNo
Team collaborationYes (built-in)Yes (workspace)NoNo
OCR for scanned docsYesYesLimitedYes
Learning curveMediumLowMedium-HighLow
Best forComplex docs, legal, finance, researchGeneral-purpose chatbotsFully offline, privacy-focusedQuick PDF Q&A

The key difference: RAGFlow wins when document layout matters. If your PDFs contain tables, multi-column text, or complex formatting, RAGFlow’s DeepDoc parser will give significantly better retrieval accuracy than Dify’s standard parser or ChatPDF’s black-box approach.


Prerequisites

Before installing RAGFlow, ensure you have:

  1. Docker Desktop (version 20.10 or later) or Docker Engine with Docker Compose v2
  2. At least 8 GB of RAM available for Docker. RAGFlow is heavier than Dify because the DeepDoc parser runs multiple ML models for layout analysis. 16 GB is recommended for production use.
  3. At least 20 GB of free disk space for Docker images and vector storage
  4. An LLM API key (OpenAI, DeepSeek, or ZhipuAI). You can also use a local Ollama instance to go fully offline.

Docker Installation Step-by-Step

RAGFlow provides a streamlined Docker Compose setup. Open your terminal and run:

# Clone the repository
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/docker

# Start RAGFlow services
docker compose -f docker-compose.yml up -d

The first launch downloads several Docker images (Elasticsearch, MySQL, Redis, MinIO, and the RAGFlow server). This takes 5-10 minutes depending on your internet speed.

Once all containers show “healthy” in Docker Desktop, open your browser and go to:

http://localhost:80

You will see the RAGFlow login page. The default credentials are:

  • Email: admin@ragflow.io
  • Password: ragflow@123

Change the password immediately from Settings > User Settings after your first login.

What Runs Inside Docker Compose

Understanding the architecture helps with troubleshooting:

ServicePurposeDefault Port
ragflow-serverMain API and web server80
elasticsearchFull-text + vector search engine9200
mysqlMetadata and user data5455
redisCaching and task queue6379
minioObject storage for uploaded documents9000

If your machine already runs MySQL or Elasticsearch on the default ports, edit the docker-compose.yml file to avoid port conflicts.


Accessing the Web UI and Creating a Knowledge Base

After logging in, the RAGFlow interface presents four main tabs: Knowledge Base, Chat, Chat Assistant, and Model Providers.

Step 1: Configure Your LLM

Before creating a knowledge base, connect an LLM. Click Model Providers and add a model:

For OpenAI:

  • Provider: OpenAI
  • API Key: sk-your-key
  • Model: gpt-4o-mini (good balance of speed and accuracy)

For DeepSeek:

  • Provider: DeepSeek
  • API Key: your DeepSeek API key
  • Model: deepseek-chat

For local Ollama:

  • Provider: Ollama
  • Base URL: http://host.docker.internal:11434
  • Model: llama3.2 (or whichever model you pulled)
  • Embedding model: nomic-embed-text

RAGFlow uses two models: a chat model to generate answers, and an embedding model to convert text into vectors for similarity search. Make sure both are configured.

Step 2: Create a Knowledge Base

Click Knowledge Base in the top menu, then click the + Create Knowledge Base button. Give it a name like “Research Papers” or “Legal Contracts”.

You will see a configuration panel with these important settings:

  • Embedding Model: Choose the same provider you set up in Model Providers
  • Chunk Method: Choose your parsing/chunking strategy (detailed below)
  • Parser: Choose DeepDoc, Naive, or General (default: DeepDoc for PDFs)

Click OK to create the empty knowledge base.


Uploading Documents

Open your knowledge base and click the Upload button. RAGFlow accepts:

  • PDF — Full support with layout analysis
  • DOCX / DOC — Microsoft Word documents
  • Excel (.xlsx, .xls) — Spreadsheet parsing with table extraction
  • Markdown (.md) — Preserves heading hierarchy
  • TXT — Plain text
  • HTML — Web pages
  • Images (PNG, JPG) — OCR extraction with Tesseract integration
  • CSV — Tabular data

Drag and drop files or click to browse. You can upload multiple files simultaneously. RAGFlow shows a progress bar for each file as it parses and chunks the content.

Tip: For large PDFs (50+ pages), the parsing stage can take a minute or more because DeepDoc runs multiple ML models — layout detection, table structure recognition, and OCR for any embedded images. Be patient; parsing 100 pages takes roughly 2-3 minutes on a modern CPU.


Understanding Chunking Strategies

Chunking determines how RAGFlow breaks documents into searchable pieces. Choosing the right strategy dramatically affects answer quality.

Q&A Chunking

Best for: FAQ documents, knowledge base articles, instructional content.

This method uses the LLM to analyze the document and generate hypothetical question-and-answer pairs from the content. Users asking similar questions later get near-perfect matches. The downside is cost — it makes one LLM call per chunk during ingestion.

General Chunking

Best for: Most documents. The default and most versatile option.

A recursive text splitter breaks the document into overlapping chunks of configurable size. Settings to adjust:

  • Chunk size: 512 tokens (default). Increase to 1024 for longer documents where paragraphs are dense.
  • Overlap: 64 tokens. Prevents sentences from being cut in half at chunk boundaries.

Manual Chunking

Best for: Highly structured documents where you want precise control.

Use delimiter-based splitting (e.g., ##, ---, custom separators). This is ideal for Markdown documents with clear heading structures or legal documents with numbered clauses.

Table Chunking

Best for: Excel spreadsheets, financial tables, structured data.

RAGFlow recognizes table structures and chunks them as logical units rather than splitting rows across chunks. When a user asks “What was the Q3 revenue?” the system retrieves the entire relevant table, not scattered fragments.

Chunking Strategy Decision Guide

Document TypeRecommended StrategyWhy
FAQ / Help articlesQ&AQuestion-matching is highly accurate
Research papers / reportsGeneral (512 tokens)Balances context and precision
Manuals / guides with headingsManualPreserves section boundaries
Financial statements / ExcelTableKeeps tabular data coherent
Legal contractsManual + GeneralClause-level retrieval, then context expansion
Mixed PDF (text + tables)General + TableLet DeepDoc detect and route

Parsing Methods: DeepDoc vs Naive vs General

The parser is the first step — it extracts raw text from your files before chunking.

DeepDoc Parser

The crown jewel of RAGFlow. DeepDoc uses computer vision and NLP models to:

  1. Detect page layout (single-column, multi-column, mixed)
  2. Identify text blocks, headings, images, and tables
  3. Extract table data as structured JSON
  4. Apply OCR to any embedded images
  5. Merge extracted content into a coherent reading order

DeepDoc produces the best results but uses more CPU/RAM. It runs the following models locally: layout parser, table structure recognizer, and OCR engine. The first time you use it, it downloads these models (about 2 GB total) to a local cache.

Naive Parser

Uses standard PDF text extraction libraries (PyPDF2, pdfplumber). Fast and lightweight, but fails on complex layouts — multi-column PDFs come out as garbled text, tables lose structure, and images are ignored entirely. Use only for simple, single-column text documents.

General Parser

A middle ground. It uses the document’s native formatting hints (Word styles, Markdown headings, HTML tags) to understand structure. Good for DOCX and Markdown files where formatting is explicit. Not recommended for PDFs.


Testing Retrieval and Chatting with Your Documents

Once documents are parsed and indexed, click the Chat tab to start asking questions.

Direct Chat

Ask a question in the chat box and click send. RAGFlow retrieves the most relevant chunks from your knowledge base, feeds them into the LLM along with your question, and returns an answer with citation footnotes.

Each citation shows:

  • The source document name
  • The page number (for PDFs)
  • The exact text chunk used

Click any citation to open the source document at the exact location.

Chat Assistant

The Chat Assistant feature lets you create a persistent chat configuration with a custom system prompt. Think of it as a saved persona. Create one with instructions like:

You are a legal analyst reviewing contract documents. Always cite the
specific clause and page number. If information appears contradictory
across documents, flag it for the user. Use formal, precise language.

Assign your knowledge base to this assistant, and all chats through it will automatically search your documents.

Evaluating Retrieval Quality

RAGFlow provides a Retrieval Testing page (under your knowledge base) where you can enter a query and see exactly which chunks were retrieved, their relevance scores, and their source documents — without generating an LLM answer. Use this to diagnose poor retrieval before tweaking your chunking strategy.

Signs your retrieval needs tuning:

  • Chunks returned have low relevance scores (< 0.5)
  • The correct answer is in your documents but not in the top 5 retrieved chunks
  • Chunks are too short (fragments of sentences) or too long (multiple paragraphs merged)

API Access for Developers

RAGFlow exposes a comprehensive REST API. Everything you can do in the UI, you can do programmatically.

Authentication

First, get an API key from Profile > API Key. Then authenticate:

curl -X POST http://localhost:80/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@ragflow.io", "password": "your-password"}'

The response includes an access token. Use it as a Bearer token in subsequent requests.

Upload a Document via API

curl -X POST http://localhost:80/api/v1/datasets/{dataset_id}/documents \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@/path/to/document.pdf"

Ask a Question

curl -X POST http://localhost:80/api/v1/chats \ 
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "research-qa",
    "dataset_ids": ["your-dataset-id"]
  }'

The API also supports streaming responses, conversation history management, and bulk document operations. Full API reference is available in the RAGFlow documentation.


Deploying to Production

For production use, consider these adjustments:

  1. Persist all data: The Docker Compose file already uses named volumes. Do not remove them.
  2. Reverse proxy with HTTPS: Put Nginx or Caddy in front of RAGFlow with SSL termination. Never expose port 80 directly to the internet.
  3. Increase resources: In docker-compose.yml, bump memory limits for the ragflow-server. The default 8 GB may be tight for multiple concurrent users.
  4. Use a dedicated Elasticsearch cluster: For large knowledge bases (10,000+ documents), the built-in Elasticsearch container becomes a bottleneck. Point RAGFlow at an external cluster.
  5. Regular backups: Back up the MySQL database and the MinIO object storage volume. MySQL stores metadata; MinIO stores the raw documents.

A minimal production setup on a cloud VM would be: 4 vCPU, 16 GB RAM, 100 GB SSD. This comfortably serves 5-10 concurrent users querying a knowledge base of up to 5,000 documents.


FAQ

Q: How is RAGFlow different from just uploading files to ChatGPT?

ChatGPT’s file upload feature reads the entire file into its context window, which has token limits (e.g., 128K for GPT-4o). RAGFlow uses RAG to search within documents — it only retrieves the relevant parts for each question. This works at any scale (thousands of documents, millions of pages) and costs less per query.

Q: Does RAGFlow work completely offline?

Yes, if you use Ollama for LLM and embedding models. Configure Ollama as your model provider, pull a chat model and embedding model, and RAGFlow runs entirely on your machine. No internet required after the initial Docker pull and model downloads.

Q: How accurate is DeepDoc on scanned PDFs?

DeepDoc uses Tesseract OCR internally and achieves good accuracy on clean scans (300 DPI or higher). Heavily skewed pages, handwritten text, or low-resolution scans will reduce accuracy. For critical scanned documents, pre-process them with a tool like OCRmyPDF before uploading to RAGFlow.

Q: Can I use RAGFlow for non-English documents?

Yes. DeepDoc’s layout analysis is language-agnostic. Text extraction works for any language supported by the underlying libraries. Embedding models like text-embedding-3-large support over 50 languages. For best results with languages like Chinese, Japanese, or Arabic, use a multilingual embedding model such as BAAI/bge-m3.

Q: How many documents can one knowledge base handle?

There is no hard limit. Performance depends on your Elasticsearch instance. With the built-in Docker Elasticsearch, 10,000 documents is a practical ceiling before search latency becomes noticeable (> 2 seconds). Above that, deploy a dedicated Elasticsearch cluster with more RAM and shards.

Q: Can RAGFlow handle real-time document updates?

RAGFlow supports document re-parsing. You can re-upload a document, and it will re-chunk and re-index it. However, there is no automatic sync with external sources (e.g., Google Drive, SharePoint). You must trigger updates manually or via the API.

Q: What is the cost of running RAGFlow?

The software itself is free and open-source (Apache 2.0). Your costs are: (a) server/VM hosting if not running locally, (b) LLM API costs for queries (roughly $0.01-0.05 per question with GPT-4o-mini, or $0 with Ollama), and (c) one-time embedding costs for document ingestion (roughly $0.02 per 100 pages with text-embedding-3-small).

Q: Can I share a knowledge base with others without giving them server access?

Yes. Create a Chat Assistant linked to your knowledge base, then share the assistant’s URL. Viewers can ask questions and see answers but cannot modify documents, settings, or the knowledge base itself.

Q: How does RAGFlow handle conflicting information across documents?

RAGFlow retrieves all relevant chunks and presents them to the LLM. If your documents contain contradictory statements, the LLM will typically summarize both sides. You can add a prompt instruction like “If information conflicts across documents, present both viewpoints and note the discrepancy” to your Chat Assistant configuration.


This guide was updated in June 2026 for RAGFlow version 0.15+. Always refer to the official RAGFlow documentation for the latest configuration options, API changes, and new features.

🛠️

Written by ToolMix

We test and review software so you don't have to. Independent, honest, and always free. Got feedback? Use the form at the bottom of the page.

Frequently Asked Questions

Related Articles

10 Best AI Writing Tools in 2026: Tested & Compared
ai-tools

10 Best AI Writing Tools in 2026: Tested & Compared

2026年10款AI写作工具实测横评:Claude vs ChatGPT vs DeepSeek vs Jasper——博客、营销文案、创意写作各场景谁最强?附免费版额度对比+写作质量盲测结果,帮你每月省$200文案外包费。

8 min read
15 Free AI Tools to 10x Your Productivity in 2026
ai-tools

15 Free AI Tools to 10x Your Productivity in 2026

2026年15款真正免费的AI生产力工具实测:Claude vs DeepSeek vs ChatGPT写作对比、Cursor vs Copilot编程对决、Canva AI设计上手。附横向对比表+免费额度详解。每个工具都有免费档,每月省$200+订阅费。

10 min read