Skip to main content

quickstart

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding. When integrated with LLMs, it is capable of providing truthful question-answering capabilities, backed by well-founded citations from various complex formatted data.

This quick start guide describes a general process from:

  • Starting up a local RAGFlow server,
  • Creating a dataset,
  • Establishing an AI chat based on your datasets.
IMPORTANT

This guide deploys the Go backend with the repository's Go Docker image and Compose configuration. The supported native Docker build target is Linux x86-64. Linux ARM64 is not currently a supported native target because the Go image depends on native libraries published for x86-64.

Prerequisites

  • A recommended starting configuration of 4 CPU cores (x86-64), 16 GB RAM, and 50 GB free disk space. Actual requirements depend on the document engine, data volume, parsing workload, and concurrency. Local models and OceanBase require additional resources.
  • Docker ≥ 24.0.0 with Docker Compose ≥ v2.26.1 and BuildKit;
  • Access to the dependency image infiniflow/ragflow_deps:latest during the image build, and to an LLM and embedding model at runtime.

If Docker is not installed, see Install Docker Engine.

Start up the server

  1. For the default Elasticsearch document engine, ensure vm.max_map_count is at least 262144 on the Docker host:

    sysctl vm.max_map_count
    sudo sysctl -w vm.max_map_count=262144

    The change made with sysctl -w is temporary. To keep it after a reboot, set vm.max_map_count=262144 in /etc/sysctl.conf. On Docker Desktop, apply the setting to its Linux VM.

  2. Clone the repository:

    git clone https://github.com/infiniflow/ragflow.git
  3. Check out the Go release tag and start the prebuilt Go image with Docker Compose:

    # Enter the Docker deployment directory.
    cd ragflow/docker
    # Check out the Go v1.0.0-rc1 release tag.
    git checkout v1.0.0-rc1
    # Start the Go services and their dependencies in the background.
    docker compose -f docker-compose.yml up -d

    The docker/.env file controls DOC_ENGINE, service ports, and dependency credentials. Change the default passwords before deploying to a network-accessible host.

    In the RAGFlow open-source 1.0 release, DeepDoc layout analysis, OCR, and table recognition use CPU inference.

    Development checkouts

    A development checkout can report a code version older than the database migration version, including immediately after its own migrations. In that case, the Go server refuses to start with Refusing to start: database was migrated by a newer version. For local development with this checkout, set RAGFLOW_DEV_MODE=true in .env and run the Compose command again. This disables the database downgrade check; leave RAGFLOW_DEV_MODE=false for production, and use a binary whose version is at least the database migration version.

  4. Check that the service is running:

    docker compose -f docker-compose.yml ps
    docker logs -f ragflow-cpu

    After initialization, check the Go API and its dependencies through the web port from another terminal:

    curl -f http://localhost/api/v1/system/healthz

    A successful response has HTTP status 200. If you changed SVR_WEB_HTTP_PORT in .env, include that port in the URL. Wait for this check to pass before opening the web interface.

  5. Open http://IP_OF_YOUR_MACHINE in a browser and log in. If you changed SVR_WEB_HTTP_PORT in .env, include that port in the URL.

The Go container runs the API server, ingestion workers, and data synchronization. Its startup script runs the Go database migrations before starting the services.

Configure LLMs

RAGFlow is a RAG engine and needs to work with an LLM to offer grounded, hallucination-free question-answering capabilities. RAGFlow supports most mainstream LLMs. For a complete list of supported models, please refer to Supported Models.

note

RAGFlow also supports deploying LLMs locally using Ollama, Xinference, or LocalAI, but this part is not covered in this quick start guide.

To add and configure an LLM:

  1. Click on your logo on the top right of the page > Model providers.

  2. Click on the desired LLM and update the API key accordingly.

  3. Click Set default models to select the default models:

    • Chat model,
    • Embedding model,
    • Image-to-text model,
    • and more.

Some models, such as the image-to-text model qwen-vl-max, are subsidiary to a specific LLM. And you may need to update your API key to access these models.

Create your first dataset

You can upload files to a dataset in RAGFlow and parse them into chunks. A dataset is a collection of documents. Question answering in RAGFlow can be based on one or more datasets. Supported file formats include documents (PDF, DOC, DOCX, TXT, MD, MDX), tables (CSV, XLSX, XLS), images (JPEG, JPG, PNG, TIF, GIF), and slides (PPT, PPTX).

To create your first dataset:

  1. Click the Dataset tab in the top middle of the page > Create dataset.

  2. Input the name of your dataset and click OK to confirm your changes.

    You are taken to the Configuration page of your dataset.

    dataset configuration

  3. RAGFlow offers multiple chunk templates that cater to different document layouts and file formats. Select the embedding model and chunking method (template) for your dataset.

    IMPORTANT

    Once you have selected an embedding model and used it to parse a file, you are no longer allowed to change it. The obvious reason is that we must ensure that all files in a specific dataset are parsed using the same embedding model (ensure that they are being compared in the same embedding space).

    You are taken to the Dataset page of your dataset.

  4. Click + Add file > Local files to start uploading a particular file to the dataset.

  5. In the uploaded file entry, click the play button to start file parsing:

    parse file

    If parsing stalls, check the ragflow-cpu service logs with the Compose command above for ingestion errors.

Intervene with file parsing

RAGFlow features visibility and explainability, allowing you to view the chunking results and intervene where necessary. To do so:

  1. Click on the file that completes file parsing to view the chunking results:

    You are taken to the Chunk page:

    chunks

  2. Hover over each snapshot for a quick view of each chunk.

  3. Double click the chunked texts to add keywords or make manual changes where necessary:

    update chunk

    NOTE

    You can add keywords or questions to a file chunk to improve its ranking for queries containing those keywords. This action increases its keyword weight and can improve its position in search list.

  4. In Retrieval testing, ask a quick question in Test text to double check if your configurations work:

    As you can tell from the following, RAGFlow responds with truthful citations.

    retrieval test

Set up an AI chat

Conversations in RAGFlow are based on a particular dataset or multiple datasets. Once you have created your dataset and finished file parsing, you can go ahead and start an AI conversation.

  1. Click the Chat tab in the middle top of the page > Create chat to create a chat assistant.

  2. Click the created chat app to enter its configuration page.

    RAGFlow lets you choose a chat model for each dialogue. You can configure the defaults under Set default models.

  3. Update Chat setting on the right of the configuration page:

    • Name your assistant and specify your datasets.
    • Empty response:
      • If you wish to confine RAGFlow's answers to your datasets, leave a response here. Then when it doesn't retrieve an answer, it uniformly responds with what you set here.
      • If you wish RAGFlow to improvise when it doesn't retrieve an answer from your datasets, leave it blank, which may give rise to hallucinations.
  4. Update System prompt or leave it as is for the beginning.

  5. Select a chat model in the Model dropdown list.

  6. Now, let's start the show:

    chat_thermal_solution

NOTE

RAGFlow also offers an HTTP API for integrating its capabilities into your applications: