RAG Knowledge Base with RAGFlow
Deploy a self-hosted RAG platform that answers questions about your documents.
Introduction
30 Second Summary
Your company has years of safety documents, equipment specs, contracts, and quotes scattered across folders. Finding a specific IP rating or PPE requirement means opening ten PDFs and scanning through pages manually.
In this project, you will deploy RAGFlow as a self-hosted document intelligence platform that ingests your CCTV and security industry documents and answers natural-language questions with citation-backed responses.
What You'll Build
You will ask your knowledge base a specific question about a RAMS document or equipment spec, and get back a precise answer highlighting the exact paragraph it came from.
By the end of this project, you'll have:
- A knowledge base that automatically chunks and embeds your PDF, DOCX, and other documents, letting you ask natural-language questions and receive grounded answers citing the exact source paragraph.
- GPU-accelerated deep document parsing that preserves table structures, headers, and complex layouts from your security industry documents without losing context.
- Verified grounded refusal behaviour where the system declines to answer questions not covered in your documents, instead of hallucinating.
- Secret Mission: A Python API client that queries your knowledge base programmatically via REST API, ready to connect to future automation workflows.
Are there any prerequisites?
This project builds on the CLIVE Platform Foundation (Project 1). You need Ubuntu 24.04 with Docker and Docker Compose installed, NVIDIA drivers and container toolkit configured, and Ollama running with the llama3.2 model.
Before We Start
Before We Start...
Before we dive in, let's lock in what you're about to build and why it matters.
Your Ollama instance can generate text, but it knows nothing about your company's actual documents. This project gives it that knowledge by building a retrieval layer on top. Gather 5-10 sample CCTV/security industry documents (RAMS, equipment specs, contracts, or quotes) so you have real material ready to ingest.
Deploy RAGFlow via Docker Compose
Your Ollama instance can generate text, but it has no access to your company documents. Without a retrieval layer, asking about your specific RAMS, contracts, or equipment specs will produce hallucinated answers.
RAGFlow adds the document intelligence layer that makes your local LLM useful for real work. In this step, you will deploy the full RAGFlow stack via Docker Compose with GPU-accelerated document parsing on your RTX 3080.
In this step, get ready to:
- Prepare your system's virtual memory settings and clone the RAGFlow repository.
- Configure GPU acceleration and Linux Docker networking for Ollama connectivity.
- Start the full RAGFlow stack and verify all containers are healthy.
Prepare the system for Elasticsearch and clone RAGFlow
RAGFlow uses Elasticsearch as its search engine for both full-text and vector storage. Elasticsearch requires a Linux kernel parameter called vm.max_map_count to be at least 262144. The default on most Linux systems is far too low, so Elasticsearch will crash on startup without this change.
- Set the virtual memory limit permanently and apply it immediately by running these commands:
# Add the setting to sysctl.conf so it persists across reboots
echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
# Apply the change immediately without rebooting
sudo sysctl -p
What does this command do?
Elasticsearch memory-maps many files at once. The vm.max_map_count parameter controls how many memory-mapped areas a process can have. Writing it to /etc/sysctl.conf makes the setting permanent across reboots. Running sysctl -p applies it right now without restarting.
- Confirm the setting took effect by running:
sysctl vm.max_map_count
You should see vm.max_map_count = 262144 in the output.
Seeing permission denied?
Make sure you included sudo in the commands. The /etc/sysctl.conf file is owned by root and cannot be written without elevated permissions.
Help me fix the vm.max_map_count permission error on Ubuntu 24.04.
- Clone the RAGFlow repository and check out the version tag that matches the Docker image by running these commands:
cd ~
git clone https://github.com/infiniflow/ragflow.git
cd ragflow
git checkout v0.26.4
Why check out a specific version tag?
The Docker image you will pull is infiniflow/ragflow:v0.26.4. Checking out the matching tag ensures that configuration files like entrypoint.sh are compatible with the image version.
- Confirm the clone worked by listing the docker directory:
ls ~/ragflow/docker
You should see files including docker-compose.yml, .env, and docker-compose-base.yml.
Clone failed or directory is empty?
Check your internet connection. The RAGFlow repository is approximately 100 MB. If the clone was interrupted, delete the partial directory and try again.
Help me troubleshoot git clone failing for the RAGFlow repository.
Configure GPU acceleration and Docker networking
RAGFlow's document parsing engine (DeepDoc) can use your RTX 3080 for OCR and layout analysis. On Linux, Docker containers cannot reach host services by default. The GPU profile in RAGFlow's compose file already includes the networking fix your setup needs.
- Move into the Docker configuration directory by running:
cd ~/ragflow/docker
- Enable GPU acceleration by running:
sed -i '1i DEVICE=gpu' .env
What does this command do?
This inserts DEVICE=gpu at the first line of the .env file. The .env file controls which Docker Compose profile runs.
Setting DEVICE to gpu activates the ragflow-gpu service, which includes NVIDIA GPU passthrough for document parsing AND an extra_hosts entry mapping host.docker.internal to your host machine. This is how RAGFlow containers will reach Ollama on port 11434.
- Verify the change took effect by running:
head -3 .env
The first line should now read DEVICE=gpu.
How does Docker networking work here?
On Linux, containers cannot resolve host.docker.internal by default (unlike macOS and Windows). The ragflow-gpu service in docker-compose.yml already includes extra_hosts: - "host.docker.internal:host-gateway" which maps that hostname to your host IP. You do not need to edit the compose file manually.
Don't see DEVICE=gpu on line 1?
Make sure you ran the sed command from inside the ~/ragflow/docker directory where the .env file lives. If you ran it from a different directory, the command silently did nothing.
Help me fix the .env GPU configuration for RAGFlow.
Start the RAGFlow stack and verify containers are healthy
With the configuration set, you can now start the entire stack. Docker Compose will pull the RAGFlow image (approximately 2 GB) plus images for Elasticsearch, MySQL, MinIO, and Redis.
- Start all services in detached mode by running:
docker compose -f docker-compose.yml up -d
What gets started?
This command launches the full RAGFlow stack: the RAGFlow server (with GPU passthrough for DeepDoc), Elasticsearch for search and vector storage, MySQL for metadata, MinIO for document object storage, and Redis for caching.
The first run takes several minutes as Docker pulls all the images. Wait for the command to finish before continuing.
- Once the pull finishes, check that all containers are running and healthy:
docker compose -f docker-compose.yml ps
You should see all services listed with a status of Up or healthy. If any service shows starting, wait another minute and run the command again. Elasticsearch can take up to 60 seconds to pass its health check.
Seeing containers exit or restart?
If Elasticsearch keeps restarting, confirm vm.max_map_count is set correctly by running sysctl vm.max_map_count. It must show 262144.
If the RAGFlow server exits, check logs with docker compose -f docker-compose.yml logs ragflow-gpu. A common cause is the NVIDIA Container Toolkit not being configured correctly for Docker.
Help me debug RAGFlow containers that keep restarting.
Before you open the browser, what do you expect to see at http://localhost:9380? Think about whether RAGFlow needs any additional configuration before it can show you something.
- Open your browser and navigate to http://localhost:9380.
You should see the RAGFlow login and registration page. This confirms the entire stack is running correctly and the web UI is being served on port 9380.
Register your admin account now
Click the registration link and create your account. Since this is a local instance, use any email and password you will remember. The first account you register becomes the admin.
Page not loading at localhost:9380?
RAGFlow takes up to 60 seconds after all containers show healthy before the web UI responds. Wait a full minute and refresh the page.
If it still does not load, verify the port mapping by running docker compose -f docker-compose.yml ps and confirm you see 0.0.0.0:9380->9380/tcp in the ports column for the ragflow service.
Help me figure out why RAGFlow is not loading on localhost:9380.
Your RAGFlow stack is live and serving the web UI. Next up, you will connect your existing Ollama models so RAGFlow can use them for embeddings and chat.
Connect Ollama and Pull the Embedding Model
Your RAGFlow stack is running and ready to parse documents. But it has no models to work with yet.
RAGFlow needs two models from Ollama: a chat model to generate answers (llama3.2, which you already have) and an embedding model to convert document chunks into searchable vectors (bge-m3). Without embeddings, RAGFlow cannot perform semantic search across your documents.
In this step, get ready to:
- Pull the bge-m3 embedding model into Ollama.
- Register Ollama as a model provider in RAGFlow with both models connected.
- Set default chat and embedding models in RAGFlow's System Model Settings.
Pull the bge-m3 embedding model
The bge-m3 model is a 567M-parameter model purpose-built for multilingual embedding and retrieval tasks. It converts text into numerical vectors that RAGFlow uses to find relevant document chunks when you ask a question.
- Pull the embedding model into Ollama by running this command:
ollama pull bge-m3
What does this command do?
This downloads the bge-m3 model (~1.2GB) from the Ollama registry and makes it available locally. Once pulled, any service that can reach Ollama on port 11434 can use it for generating embeddings.
The download takes a few minutes depending on your connection speed. Once complete, you should see a success message.
- Verify the model is available by running:
ollama list
You should see bge-m3 listed alongside llama3.2 and qwen2.5-coder:7b in the output.
Model pull failing or timing out?
- Check your internet connection. The bge-m3 model is approximately 1.2GB and requires a stable connection.
- Make sure Ollama is running. Run systemctl status ollama or ollama --version to confirm.
- If you see a disk space error, free up space on your drive. The model needs roughly 1.2GB free.
help me troubleshoot why ollama pull bge-m3 is failing on my Ubuntu machine
Add Ollama as a model provider in RAGFlow
Now that both models are available in Ollama, you need to tell RAGFlow where to find them. You will add Ollama as a model provider and register each model with its correct type.
- In the RAGFlow web UI, click your avatar or logo on the top right of the page.
- Click Model providers.
- Find Ollama in the list of available providers and click it to add it.
A settings panel appears where you configure the connection to your Ollama instance.
- In the Base URL field, enter http://host.docker.internal:11434.
- In the model name field, enter llama3.2.
- Set the model type to chat.
- Click OK or Confirm to save.
Why host.docker.internal?
RAGFlow runs inside a Docker container. On Linux, containers cannot reach the host machine at localhost because that resolves to the container itself. The extra_hosts configuration you added in the previous step maps host.docker.internal to the host machine's IP, so RAGFlow containers can reach Ollama on port 11434.
- Add the second model. Click to add another model under the same Ollama provider.
- Enter bge-m3 as the model name.
- Set the model type to embedding.
- Click OK or Confirm to save.
You should now see both llama3.2 and bge-m3 listed under the Ollama provider in your Model providers page.
Seeing a connection error when adding Ollama?
- Double-check that your base URL is exactly http://host.docker.internal:11434 with no trailing slash.
- Confirm Ollama is running on the host by opening a new terminal and running ollama list. If this fails, restart Ollama.
- Make sure the model name you entered matches the Ollama model name exactly. Use llama3.2 not llama-3.2 or Llama3.2.
help me fix the connection error when adding Ollama as a model provider in RAGFlow on Linux
Set default models in System Model Settings
With both models registered, you now tell RAGFlow which model to use by default for chat generation and which to use for embedding documents.
- Click your avatar or logo on the top right of the page.
- Click Model providers.
- Click System Model Settings.
- In the Chat model dropdown, select llama3.2.
- In the Embedding model dropdown, select bge-m3.
- Click Save to apply your defaults.
Before you close this page, look at both dropdown lists. What models do you expect to see in each?
You should see llama3.2 selected in the Chat model dropdown and bge-m3 selected in the Embedding model dropdown. Both should show as connected with no error indicators.
Models not appearing in the dropdowns?
- Go back to the Model providers list and verify that both models appear under the Ollama provider without error icons.
- If a model shows an error, click it to re-check the configuration. The model name and type must match exactly what Ollama reports.
- Try refreshing the RAGFlow page in your browser, then navigate back to System Model Settings.
help me fix models not appearing in RAGFlow System Model Settings dropdowns after adding Ollama
Both models are connected and RAGFlow knows where to find them. Next up, you will create a knowledge base and feed it your CCTV and security industry documents.
Create a Knowledge Base and Ingest Documents
Your models are connected, but RAGFlow has zero company knowledge. Right now, if you asked it about your CCTV installation procedures or equipment specs, it would have nothing to draw on.
This step feeds your actual CCTV/security documents into the system. RAGFlow will parse the document structure (headers, tables, paragraphs), chunk it intelligently, and embed each chunk into searchable vectors stored in Elasticsearch.
In this step, get ready to:
- Create a knowledge base configured with the bge-m3 embedding model and an appropriate chunking method.
- Upload and parse 5-10 CCTV/security industry documents.
- Review chunking results and manually adjust any problematic chunks.
Create a new knowledge base dataset
A knowledge base (called a "dataset" in RAGFlow) is a container that holds your uploaded documents, their parsed chunks, and the embeddings that make them searchable.
- In your browser, return to the RAGFlow UI at http://localhost:9380.
- Click + Create dataset to create a new dataset.
- Enter a descriptive name for your knowledge base, such as CVC Security Documents.
Why does the name matter?
You can create multiple datasets in RAGFlow to separate different document types. A clear name helps you identify which knowledge base to attach to a chat assistant later.
- Navigate to the Configuration page of your newly created dataset.
- Under Parse type, select Built-in in the Ingestion pipeline section.
- From the Built-in chunking method dropdown, select General.
Why the General chunking method?
The General method chunks files based on a preset token count while respecting paragraph boundaries. It supports the widest range of file formats including PDF, DOCX, XLSX, and images.
Your CCTV/security documents (RAMS, contracts, equipment specs) are mixed-format with varied layouts. General handles this variety well. If you later find that specific documents need a different approach (e.g. a pure spreadsheet might benefit from Table mode), you can override the chunking method per file.
- Under Embedding model, confirm that bge-m3 is selected. This should already be the default since you set it as the system embedding model in the previous step.
- Click Save to confirm your dataset configuration.
Your empty knowledge base is now configured and ready to receive documents.
Can I change the embedding model later?
No. Once your dataset has chunks, the embedding model is locked. All chunks must live in the same embedding space for similarity search to work correctly. If you need to switch models later, you must delete all existing chunks first.
Upload documents and trigger parsing
With the dataset configured, you can now upload your CCTV/security industry documents. RAGFlow will use your RTX 3080 via the DeepDoc service to perform layout analysis, OCR, and table structure recognition on each file.
- Gather 5-10 sample documents from your company files. Good candidates include RAMS documents, equipment specification sheets, contracts, quotes, and any PDF/DOCX files with tables or structured content.
- On your dataset's page, navigate to the Files tab.
- Click the upload button and select your documents from your local machine. You can upload a single file or a folder of files (bulk upload).
Supported file formats
RAGFlow's General chunking method accepts PDF, DOCX, XLSX, XLS, PPT, TXT, MD, JPEG, JPG, PNG, TIF, GIF, CSV, JSON, EML, and HTML files. For best results with your security industry documents, PDF and DOCX give the richest layout analysis.
- After uploading, select all your files and click the parse/play button to start parsing.
What happens during parsing?
Parsing in RAGFlow does two things simultaneously. First, it chunks your files based on document layout (respecting headers, tables, and paragraph boundaries). Second, it builds both embedding (vector) and full-text (keyword) indexes on those chunks.
The DeepDoc service uses your GPU for Document Layout Analysis (DLA), OCR, and Table Structure Recognition (TSR). This is why GPU passthrough was configured in Step 1.
- Monitor the parsing progress. Each file shows a status indicator. Wait for all documents to reach a completed status.
Parsing stuck or failing?
If parsing stalls for a long time, click the cancel icon next to the file, then retry parsing. Large PDF files with many pages can take several minutes per document.
If parsing fails entirely, check that your Elasticsearch container is healthy and that the DeepDoc container has GPU access. Run docker compose -f docker-compose.yml ps from your ~/ragflow/docker directory to verify all containers show as healthy.
Why are my documents failing to parse?
Once all files show as completed, your documents have been chunked and embedded. The Elasticsearch index for this dataset was created automatically during the first successful parse.
Review chunking results and adjust where needed
RAGFlow gives you full visibility into how it chunked your documents. This is critical for RAG quality. Poorly chunked documents lead to irrelevant retrieval and hallucinated answers.
- Click on one of your parsed documents (e.g. a RAMS file or equipment spec) to view its chunking results.
- You are taken to the Chunk page. Hover over each chunk snapshot for a quick preview of its content.
Look for these signs of good chunking:
- Tables are preserved as complete units, not split across chunks.
- Section headers stay attached to their body text.
- No chunks are cut mid-sentence.
- Each chunk contains a coherent, self-contained piece of information.
- If you find a chunk that splits important context (e.g. a table header separated from its rows, or a safety requirement split across two chunks), double-click the chunk text to edit it.
- You can merge content, add keywords, or add questions to improve retrieval for that chunk.
- Review at least 3-4 documents to confirm consistent quality across your dataset.
When should I manually intervene?
Manual adjustment is worth it for chunks that contain high-value information your team will frequently query. For example, if a RAMS document's risk assessment table got split in half, merging those chunks ensures the full context is retrieved together.
You do not need to edit every chunk. Focus on tables, key specifications, and any content that looks incomplete when viewed in isolation.
Before you move on, predict what you expect to see: if you click into a document, should its chunks look like complete paragraphs, or fragmented half-sentences?
Click into one more document and confirm that tables and headers are preserved as coherent units, not split mid-sentence. This is the verification that your chunking configuration is working correctly.
Dataset not appearing when creating an assistant later?
A dataset only becomes available for chat assistants after at least one document has been successfully parsed with chunks created AND a healthy Elasticsearch index exists. If your dataset does not appear in the knowledge base dropdown when creating an assistant, confirm that your documents show chunks (not just a completed status) and that Elasticsearch is healthy.
My parsed dataset isn't showing up when I try to create a chat assistant.
Your knowledge base is populated and ready for querying. Next up, you will create a chat assistant that uses these documents to answer questions with grounded citations.
Test Document-Grounded Conversation
Your knowledge base has documents parsed and embedded, but the real test is whether the system can answer domain-specific questions using your documents as evidence. Without a retrieval layer doing its job, the LLM will hallucinate answers about your specific RAMS, contracts, and equipment specs.
In this step, you will create a chat assistant, ask it questions only your documents can answer, and confirm that every response cites the exact source paragraph. If it hallucinates instead of citing, the pipeline is broken.
In this step, get ready to:
- Create a chat assistant linked to your CCTV/security knowledge base.
- Ask increasingly specific questions and receive grounded answers with citations.
- Confirm the system refuses to hallucinate on questions outside your documents.
Create a chat assistant linked to your knowledge base
A chat assistant in RAGFlow combines a knowledge base with a chat model into a conversational interface. Each assistant is a unique combination of datasets, prompts, and model settings.
- In the RAGFlow web UI, click the Chat tab in the middle top of the page.
- Click Create an assistant to open the Chat Configuration dialogue.
- Enter a name for your assistant, such as CCTV Security Assistant.
- Under Knowledge bases, select your CCTV/security knowledge base.
- In the Empty response field, enter a message like: I cannot find relevant information in the knowledge base to answer this question. This confines RAGFlow's answers to your documents instead of allowing it to improvise.
- In the Model section, confirm llama3.2 is selected as the chat model.
- Click OK to save the assistant.
Your new assistant appears in the Chat list. Click on it to enter the conversation interface.
What is the Empty response field?
When RAGFlow cannot retrieve relevant chunks from your documents, it uses this fixed response instead of letting the LLM improvise. This is how you prevent hallucination.
Without it, the model will confidently generate plausible-sounding answers that have no basis in your actual documents. For a CCTV/security business, that could mean fabricated safety requirements or invented equipment specifications.
Don't see your knowledge base in the Datasets list?
All datasets in the selection list must use the same embedding model. If your knowledge base does not appear, confirm it was configured with bge-m3 as the embedding model in Step 3.
Help me troubleshoot my missing knowledge base
Ask domain-specific questions and verify answers
The true measure of a RAG system is whether it produces correct, grounded answers for questions that only your documents can answer. You will start broad and drill into specifics.
- In the chat interface, type a broad question about one of your uploaded documents. For example: What equipment is specified in [document name]? (replace with an actual document name from your knowledge base).
- Press Enter to send the question.
- Wait for the response. RAGFlow retrieves relevant chunks, passes them to llama3.2, and generates an answer with source references displayed alongside it.
You should see the response text accompanied by numbered citation references. These link back to the specific chunks in your documents that the answer draws from.
- Ask a more specific question that targets a concrete detail in one of your documents. For example: What is the IP rating of the [specific camera model]? or What PPE is required in the [specific RAMS]?.
- Ask a third question that requires information from a different document than the first two.
- Ask a fourth question that combines details across documents, such as: What safety requirements apply to [specific site] installations?.
For each answer, confirm citation references are present. Each citation identifies the source document name and the specific text passage used to generate that part of the answer.
What do the citation references show?
RAGFlow inserts citation markers in the answer text that map to retrieved chunks from your knowledge base. Each citation identifies the source document name and the specific text passage used to generate that part of the answer.
This is what makes RAG different from a bare LLM. Every claim in the answer traces back to a real paragraph in your documents.
Getting vague or incorrect answers?
If answers seem unrelated to your documents, check that you selected the correct dataset when creating the assistant. Also verify that the documents finished parsing to 'completed' status in Step 3.
If the response is very slow (more than 30 seconds), your RTX 3080 may be under load from both DeepDoc and Ollama. Wait for the response to complete.
Help me troubleshoot vague answers from my RAGFlow assistant
Verify citation quality and grounded refusal
Correct answers are only half the test. A production-ready RAG system must also refuse to answer when it lacks evidence. This prevents the dangerous case where the system confidently invents information about your contracts or safety procedures.
- For each answer you received, click on the citation references to confirm they link to the correct source chunk.
- Verify the cited text actually supports the answer given.
- Check that the document name shown in the citation matches the document you expected the answer to come from.
Now test what happens when you ask something your documents cannot answer.
- Ask a question that is clearly NOT covered in any of your uploaded documents. For example: What is the company's revenue for 2024? (assuming you did not upload financial documents).
Before you check the response, what do you expect the system to say? Will it attempt an answer, or will it use the empty response you configured?
You should see your configured empty response message. This is a grounded refusal. The system knows its limits instead of inventing an answer.
Why does grounded refusal matter?
In a CCTV/security business, a hallucinated safety requirement or fabricated equipment specification could create real liability. Grounded refusal means the system explicitly tells you when it does not have evidence, so you never mistake AI confidence for documentary proof.
System still answering questions outside your documents?
If the system provides answers to questions your documents cannot support, return to the assistant settings. Click on your assistant card in the Chat list, then open the configuration. Confirm the Empty response field is not blank. A blank field allows the LLM to improvise freely.
Help me fix my RAGFlow assistant that hallucinates instead of refusing
Your end-to-end RAG pipeline is now verified. Questions go in, relevant chunks are retrieved, and llama3.2 generates grounded answers with citations. The system refuses to hallucinate when evidence is missing. Next up, you will build a Python script that queries this same knowledge base programmatically, opening the door to automated workflows.
Secret mission
Programmatic API Access with Python
The web UI proves your RAG pipeline works, but your future Simpro integration, document generation engine, and sales agent all need programmatic access. In this secret mission, you will build a Python script that queries your knowledge base via RAGFlow's REST API. This script becomes the foundation for every automated workflow you will build on top of RAGFlow.
Clean Up Your Resources
Clean Up Your Resources
This project runs entirely locally, so there are no ongoing cloud costs. Decide whether to keep your resources running, pause them to come back later, or delete them entirely.
Resources you used:
- RAGFlow Docker stack (ragflow-server, elasticsearch, mysql, minio, redis, deepdoc containers).
- Persistent Docker volumes for Elasticsearch data, MySQL data, MinIO storage, and Redis.
- bge-m3 embedding model in Ollama (~1.2GB disk space).
- RAGFlow git repository cloned to ~/ragflow.
- query_ragflow.py script (Secret Mission).
Keep everything running
No action needed. Choose this if you plan to keep building on CLIVE and want your knowledge base available for the next project (Document Generation Engine).
- The RAGFlow stack uses approximately 4-6GB RAM when idle. Your documents persist in the MinIO and Elasticsearch volumes.
- The bge-m3 model stays available in Ollama alongside your existing llama3.2 and qwen2.5-coder:7b models.
- The vm.max_map_count=262144 setting in /etc/sysctl.conf remains. This is harmless and benefits any future Elasticsearch usage.
Pause - I'll come back to this later
Shut down the RAGFlow containers to free up RAM while keeping all your data intact in Docker volumes.
- Stop the RAGFlow stack by running this from ~/ragflow/docker:
cd ~/ragflow/docker
docker compose -f docker-compose.yml down
- Your ingested documents, embeddings, and knowledge base configuration all persist in Docker volumes.
- When you are ready to resume, start the stack again by running:
cd ~/ragflow/docker
docker compose -f docker-compose.yml up -d
- The bge-m3 model stays in Ollama and does not need to be re-downloaded.
Delete - I don't want to use this again
Remove all project resources and start fresh. This deletes all ingested documents, embeddings, and knowledge base data permanently.
- Stop the RAGFlow stack and remove all Docker volumes by running:
cd ~/ragflow/docker
docker compose -f docker-compose.yml down -v
The -v flag removes all persistent volumes. Your ingested documents, embeddings, and database records are permanently deleted.
- Remove the bge-m3 embedding model from Ollama by running:
ollama rm bge-m3
- Remove the RAGFlow repository from your system by running:
rm -rf ~/ragflow
- Remove the Python script by running:
rm query_ragflow.py
- Your llama3.2 and qwen2.5-coder:7b models in Ollama are unaffected. Those belong to Project 1 (Platform Foundation).
- The vm.max_map_count=262144 line in /etc/sysctl.conf is harmless to leave. To revert it, open the file with sudo nano /etc/sysctl.conf, delete the line, save, and run sudo sysctl -p.
Nice Work!
Nice Work!
You just deployed a fully self-hosted document intelligence platform that answers questions about your CCTV and security industry documents with accurate, citation-backed responses.
You've learned how to:
- Deploy RAGFlow v0.26.4 as a multi-container Docker stack with GPU-accelerated document parsing and connect it to your existing Ollama instance via Docker networking on Linux.
- Create a knowledge base that ingests real company documents (RAMS, contracts, equipment specs) with intelligent chunking, then query it with natural language and receive grounded answers with source citations.
- Verify that a RAG pipeline refuses to hallucinate on topics not covered by your documents, proving the retrieval layer keeps your LLM honest.
- Secret Mission: Built a Python API client (query_ragflow.py) that programmatically queries your knowledge base via the REST API, ready for integration with future Simpro and document generation workflows.
Ready to quiz yourself?