2024-03-11 16:19:03 +08:00
< div align = "center" >
2024-03-27 09:53:42 +08:00
< a href = "https://demo.ragflow.io/" >
2024-04-08 19:20:57 +08:00
< img src = "web/src/assets/logo-with-text.png" width = "520" alt = "ragflow logo" >
2024-03-11 16:19:03 +08:00
< / a >
< / div >
2024-02-28 15:01:12 +08:00
2024-03-11 16:19:03 +08:00
< p align = "center" >
< a href = "./README.md" > English< / a > |
2024-04-04 10:26:39 +09:00
< a href = "./README_zh.md" > 简体中文< / a > |
< a href = "./README_ja.md" > 日本語< / a >
2024-03-11 16:19:03 +08:00
< / p >
2024-02-28 15:01:12 +08:00
2024-03-11 16:19:03 +08:00
< p align = "center" >
2024-04-25 19:34:21 +08:00
< a href = "https://github.com/infiniflow/ragflow/releases/latest" >
2024-04-25 14:31:54 +08:00
< img src = "https://img.shields.io/github/v/release/infiniflow/ragflow?color=blue&label=Latest%20Release" alt = "Latest Release" >
< / a >
2024-03-27 09:53:42 +08:00
< a href = "https://demo.ragflow.io" target = "_blank" >
2024-05-04 15:31:11 +08:00
< img alt = "Static Badge" src = "https://img.shields.io/badge/Online-Demo-4e6b99" > < / a >
2024-03-11 16:19:03 +08:00
< a href = "https://hub.docker.com/r/infiniflow/ragflow" target = "_blank" >
2024-07-08 17:06:33 +08:00
< img src = "https://img.shields.io/badge/docker_pull-ragflow:v0.8.0-brightgreen" alt = "docker pull infiniflow/ragflow:v0.8.0" > < / a >
2024-05-30 18:00:02 +08:00
< a href = "https://github.com/infiniflow/ragflow/blob/main/LICENSE" >
2024-06-07 09:06:46 +08:00
< img height = "21" src = "https://img.shields.io/badge/License-Apache--2.0-ffffff?labelColor=d4eaf7&color=2e6cc4" alt = "license" >
2024-03-11 16:19:03 +08:00
< / a >
< / p >
2024-03-29 09:51:36 +08:00
2024-05-31 17:53:06 +08:00
< h4 align = "center" >
< a href = "https://ragflow.io/docs/dev/" > Document< / a > |
< a href = "https://github.com/infiniflow/ragflow/issues/162" > Roadmap< / a > |
< a href = "https://twitter.com/infiniflowai" > Twitter< / a > |
2024-06-12 10:18:46 +08:00
< a href = "https://discord.gg/4XxujFgUN7" > Discord< / a > |
2024-05-31 17:53:06 +08:00
< a href = "https://demo.ragflow.io" > Demo< / a >
< / h4 >
2024-05-29 20:02:16 +08:00
< details open >
< summary > < / b > 📕 Table of Contents< / b > < / summary >
2024-05-29 20:22:41 +08:00
- 💡 [What is RAGFlow? ](#-what-is-ragflow )
- 🎮 [Demo ](#-demo )
- 📌 [Latest Updates ](#-latest-updates )
- 🌟 [Key Features ](#-key-features )
- 🔎 [System Architecture ](#-system-architecture )
- 🎬 [Get Started ](#-get-started )
- 🔧 [Configurations ](#-configurations )
- 🛠️ [Build from source ](#-build-from-source )
- 🛠️ [Launch service from source ](#-launch-service-from-source )
- 📚 [Documentation ](#-documentation )
- 📜 [Roadmap ](#-roadmap )
- 🏄 [Community ](#-community )
- 🙌 [Contributing ](#-contributing )
2024-05-29 20:02:16 +08:00
< / details >
2024-03-31 15:07:12 +08:00
## 💡 What is RAGFlow?
2024-03-28 17:22:02 +08:00
2024-05-14 18:46:39 +08:00
[RAGFlow ](https://ragflow.io/ ) is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding. It offers a streamlined RAG workflow for businesses of any scale, combining LLM (Large Language Models) to provide truthful question-answering capabilities, backed by well-founded citations from various complex formatted data.
2024-03-11 16:19:03 +08:00
2024-05-27 14:01:52 +08:00
## 🎮 Demo
2024-05-27 20:35:08 +08:00
Try our demo at [https://demo.ragflow.io ](https://demo.ragflow.io ).
2024-06-07 19:01:09 +08:00
< div align = "center" style = "margin-top:20px;margin-bottom:20px;" >
< img src = "https://github.com/infiniflow/ragflow/assets/7248/2f6baa3e-1092-4f11-866d-36f6a9d075e5" width = "1200" / >
2024-07-09 19:16:35 +08:00
< img src = "https://github.com/infiniflow/ragflow/assets/12318111/b083d173-dadc-4ea9-bdeb-180d7df514eb" width = "1200" / >
2024-06-07 19:01:09 +08:00
< / div >
2024-05-27 14:01:52 +08:00
2024-07-18 11:20:15 +08:00
## 🔥 Latest Updates
2024-05-12 13:40:47 +08:00
2024-07-09 13:22:25 +08:00
- 2024-07-08 Supports workflow based on [Graph ](./graph/README.md ).
- 2024-06-27 Supports Markdown and Docx in the Q& A parsing method.
- 2024-06-27 Supports extracting images from Docx files.
- 2024-06-27 Supports extracting tables from Markdown files.
2024-06-14 17:09:42 +08:00
- 2024-06-14 Supports PDF in the Q& A parsing method.
2024-06-06 16:06:20 +08:00
- 2024-06-06 Supports [Self-RAG ](https://huggingface.co/papers/2310.11511 ), which is enabled by default in dialog settings.
2024-05-30 19:17:58 +08:00
- 2024-05-30 Integrates [BCE ](https://github.com/netease-youdao/BCEmbedding ) and [BGE ](https://github.com/FlagOpen/FlagEmbedding ) reranker models.
2024-05-28 20:05:02 +08:00
- 2024-05-28 Supports LLM Baichuan and VolcanoArk.
2024-05-24 08:30:08 +08:00
- 2024-05-23 Supports [RAPTOR ](https://arxiv.org/html/2401.18059v1 ) for better text retrieval.
2024-05-21 11:14:02 +08:00
- 2024-05-21 Supports streaming output and text chunk retrieval API.
2024-05-15 12:08:32 +08:00
- 2024-05-15 Integrates OpenAI GPT-4o.
2024-05-12 13:40:47 +08:00
2024-03-29 09:51:36 +08:00
## 🌟 Key Features
2024-04-01 10:54:11 +08:00
2024-03-31 21:22:40 +08:00
### 🍭 **"Quality in, quality out"**
2024-04-01 10:54:11 +08:00
2024-04-01 14:00:01 +08:00
- [Deep document understanding ](./deepdoc/README.md )-based knowledge extraction from unstructured data with complicated formats.
2024-04-01 10:54:11 +08:00
- Finds "needle in a data haystack" of literally unlimited tokens.
2024-03-31 21:35:59 +08:00
2024-03-31 21:22:40 +08:00
### 🍱 **Template-based chunking**
2024-04-01 10:54:11 +08:00
- Intelligent and explainable.
- Plenty of template options to choose from.
2024-03-31 21:35:59 +08:00
2024-03-31 21:22:40 +08:00
### 🌱 **Grounded citations with reduced hallucinations**
2024-04-01 10:54:11 +08:00
- Visualization of text chunking to allow human intervention.
- Quick view of the key references and traceable citations to support grounded answers.
2024-03-31 21:35:59 +08:00
2024-03-31 21:22:40 +08:00
### 🍔 **Compatibility with heterogeneous data sources**
2024-04-01 10:54:11 +08:00
- Supports Word, slides, excel, txt, images, scanned copies, structured data, web pages, and more.
2024-03-31 21:35:59 +08:00
2024-03-31 21:22:40 +08:00
### 🛀 **Automated and effortless RAG workflow**
2024-04-01 10:54:11 +08:00
- Streamlined RAG orchestration catered to both personal and large businesses.
- Configurable LLMs as well as embedding models.
- Multiple recall paired with fused re-ranking.
- Intuitive APIs for seamless integration with business.
2024-02-28 15:01:12 +08:00
2024-03-29 09:51:36 +08:00
## 🔎 System Architecture
2024-03-28 17:22:02 +08:00
2024-03-29 09:51:36 +08:00
< div align = "center" style = "margin-top:20px;margin-bottom:20px;" >
< img src = "https://github.com/infiniflow/ragflow/assets/12318111/d6ac5664-c237-4200-a7c2-a4a00691b485" width = "1000" / >
< / div >
2024-03-28 17:22:02 +08:00
## 🎬 Get Started
2024-03-11 16:19:03 +08:00
2024-03-29 09:51:36 +08:00
### 📝 Prerequisites
2024-04-19 18:02:53 +08:00
- CPU >= 4 cores
2024-04-24 19:22:00 +08:00
- RAM >= 16 GB
2024-04-25 14:00:48 +08:00
- Disk >= 50 GB
2024-04-11 10:13:43 +08:00
- Docker >= 24.0.0 & Docker Compose >= v2.26.1
2024-03-31 17:51:14 +08:00
> If you have not installed Docker on your local machine (Windows, Mac, or Linux), see [Install Docker Engine](https://docs.docker.com/engine/install/).
2024-03-31 15:07:12 +08:00
2024-03-31 21:35:59 +08:00
### 🚀 Start up the server
2024-03-31 15:07:12 +08:00
2024-06-03 17:01:02 +08:00
1. Ensure `vm.max_map_count` >= 262144:
2024-03-31 15:07:12 +08:00
> To check the value of `vm.max_map_count`:
>
2024-04-01 10:54:11 +08:00
> ```bash
2024-03-31 15:07:12 +08:00
> $ sysctl vm.max_map_count
> ```
>
2024-04-07 09:41:53 +08:00
> Reset `vm.max_map_count` to a value at least 262144 if it is not.
2024-03-31 15:07:12 +08:00
>
> ```bash
> # In this case, we set it to 262144:
> $ sudo sysctl -w vm.max_map_count=262144
> ```
>
> This change will be reset after a system reboot. To ensure your change remains permanent, add or update the `vm.max_map_count` value in **/etc/sysctl.conf** accordingly:
>
> ```bash
> vm.max_map_count=262144
> ```
2. Clone the repo:
2024-03-29 09:51:36 +08:00
```bash
$ git clone https://github.com/infiniflow/ragflow.git
```
2024-04-01 10:54:11 +08:00
3. Build the pre-built Docker images and start up the server:
2024-03-29 09:51:36 +08:00
2024-07-08 17:06:33 +08:00
> Running the following commands automatically downloads the *dev* version RAGFlow Docker image. To download and run a specified Docker version, update `RAGFLOW_VERSION` in **docker/.env** to the intended version, for example `RAGFLOW_VERSION=v0.8.0`, before running the following commands.
2024-05-10 09:48:24 +08:00
2024-03-31 13:15:42 +08:00
```bash
$ cd ragflow/docker
2024-04-08 19:59:31 +08:00
$ chmod +x ./entrypoint.sh
2024-03-31 13:15:42 +08:00
$ docker compose up -d
```
2024-05-10 09:48:24 +08:00
2024-03-11 16:19:03 +08:00
2024-04-07 09:41:53 +08:00
> The core image is about 9 GB in size and may take a while to load.
2024-03-31 13:15:42 +08:00
2024-03-31 19:43:16 +08:00
4. Check the server status after having the server up and running:
2024-04-01 10:54:11 +08:00
2024-03-31 13:15:42 +08:00
```bash
2024-03-31 15:07:12 +08:00
$ docker logs -f ragflow-server
2024-03-31 13:15:42 +08:00
```
2024-04-01 10:54:11 +08:00
_The following output confirms a successful launch of the system:_
2024-02-29 18:53:02 +08:00
2024-03-31 17:51:14 +08:00
```bash
2024-04-01 10:54:11 +08:00
____ ______ __
2024-03-31 17:51:14 +08:00
/ __ \ ____ _ ____ _ / ____ // /____ _ __
/ /_/ // __ `// __ ` // /_ / // __ \| | /| / /
2024-04-01 10:54:11 +08:00
/ _, _ // /_/ // /_/ // __ / / // /_/ /| |/ |/ /
/_/ |_| \__,_/ \__, //_/ /_/ \____/ |__/|__/
/____/
2024-03-31 17:51:14 +08:00
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:9380
2024-04-08 19:20:57 +08:00
* Running on http://x.x.x.x:9380
2024-03-31 17:51:14 +08:00
INFO:werkzeug:Press CTRL+C to quit
2024-04-01 10:54:11 +08:00
```
2024-04-24 17:04:23 +08:00
> If you skip this confirmation step and directly log in to RAGFlow, your browser may prompt a `network anomaly` error because, at that moment, your RAGFlow may not be fully initialized.
2024-03-11 16:19:03 +08:00
2024-04-08 19:20:57 +08:00
5. In your web browser, enter the IP address of your server and log in to RAGFlow.
2024-06-11 13:52:27 +08:00
> With the default settings, you only need to enter `http://IP_OF_YOUR_MACHINE` (**sans** port number) as the default HTTP serving port `80` can be omitted when using the default configurations.
2024-03-31 21:35:59 +08:00
6. In [service_conf.yaml ](./docker/service_conf.yaml ), select the desired LLM factory in `user_default_llm` and update the `API_KEY` field with the corresponding API key.
2024-04-01 10:54:11 +08:00
2024-06-01 16:24:10 +08:00
> See [llm_api_key_setup](https://ragflow.io/docs/dev/llm_api_key_setup) for more information.
2024-03-27 09:53:42 +08:00
2024-04-01 10:54:11 +08:00
_The show is now on!_
2024-03-28 19:15:16 +08:00
2024-03-28 17:22:02 +08:00
## 🔧 Configurations
2024-03-27 09:53:42 +08:00
2024-03-31 17:51:14 +08:00
When it comes to system configurations, you will need to manage the following files:
- [.env ](./docker/.env ): Keeps the fundamental setups for the system, such as `SVR_HTTP_PORT` , `MYSQL_PASSWORD` , and `MINIO_PASSWORD` .
- [service_conf.yaml ](./docker/service_conf.yaml ): Configures the back-end services.
2024-03-31 19:43:16 +08:00
- [docker-compose.yml ](./docker/docker-compose.yml ): The system relies on [docker-compose.yml ](./docker/docker-compose.yml ) to start up.
2024-03-31 17:51:14 +08:00
2024-04-01 10:54:11 +08:00
You must ensure that changes to the [.env ](./docker/.env ) file are in line with what are in the [service_conf.yaml ](./docker/service_conf.yaml ) file.
2024-03-29 09:51:36 +08:00
2024-03-31 21:35:59 +08:00
> The [./docker/README](./docker/README.md) file provides a detailed description of the environment settings and service configurations, and you are REQUIRED to ensure that all environment settings listed in the [./docker/README](./docker/README.md) file are aligned with the corresponding configurations in the [service_conf.yaml](./docker/service_conf.yaml) file.
2024-03-11 16:19:03 +08:00
2024-04-01 10:58:12 +08:00
To update the default HTTP serving port (80), go to [docker-compose.yml ](./docker/docker-compose.yml ) and change `80:80` to `<YOUR_SERVING_PORT>:80` .
2024-03-27 13:14:36 +08:00
2024-03-31 17:51:14 +08:00
> Updates to all system configurations require a system reboot to take effect:
2024-04-01 10:54:11 +08:00
>
2024-03-31 17:51:14 +08:00
> ```bash
> $ docker-compose up -d
> ```
2024-03-27 13:14:36 +08:00
2024-03-31 15:07:12 +08:00
## 🛠️ Build from source
To build the Docker images from source:
```bash
$ git clone https://github.com/infiniflow/ragflow.git
$ cd ragflow/
2024-05-08 12:01:26 +08:00
$ docker build -t infiniflow/ragflow:dev .
2024-03-31 15:07:12 +08:00
$ cd ragflow/docker
2024-04-08 19:59:31 +08:00
$ chmod +x ./entrypoint.sh
2024-03-31 15:07:12 +08:00
$ docker compose up -d
```
2024-05-21 16:43:58 +08:00
## 🛠️ Launch service from source
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
To launch the service from source:
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
1. Clone the repository:
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
```bash
$ git clone https://github.com/infiniflow/ragflow.git
$ cd ragflow/
```
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
2. Create a virtual environment, ensuring that Anaconda or Miniconda is installed:
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
```bash
$ conda create -n ragflow python=3.11.0
$ conda activate ragflow
$ pip install -r requirements.txt
```
```bash
# If your CUDA version is higher than 12.0, run the following additional commands:
$ pip uninstall -y onnxruntime-gpu
$ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
```
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
3. Copy the entry script and configure environment variables:
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
```bash
# Get the Python path:
$ which python
# Get the ragflow project path:
$ pwd
```
```bash
$ cp docker/entrypoint.sh .
$ vi entrypoint.sh
```
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
```bash
# Adjust configurations according to your actual situation (the following two export commands are newly added):
# - Assign the result of `which python` to `PY` .
# - Assign the result of `pwd` to `PYTHONPATH` .
# - Comment out `LD_LIBRARY_PATH` , if it is configured.
# - Optional: Add Hugging Face mirror.
PY=${PY}
export PYTHONPATH=${PYTHONPATH}
export HF_ENDPOINT=https://hf-mirror.com
```
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
4. Launch the third-party services (MinIO, Elasticsearch, Redis, and MySQL):
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
```bash
$ cd docker
$ docker compose -f docker-compose-base.yml up -d
```
2024-04-30 18:45:53 +08:00
2024-05-21 16:43:58 +08:00
5. Check the configuration files, ensuring that:
2024-05-10 09:48:50 +08:00
2024-05-21 16:43:58 +08:00
- The settings in **docker/.env** match those in **conf/service_conf.yaml** .
- The IP addresses and ports for related services in **service_conf.yaml** match the local machine IP and ports exposed by the container.
6. Launch the RAGFlow backend service:
```bash
$ chmod +x ./entrypoint.sh
$ bash ./entrypoint.sh
```
7. Launch the frontend service:
```bash
$ cd web
$ npm install --registry=https://registry.npmmirror.com --force
$ vim .umirc.ts
2024-06-08 19:02:16 +08:00
# Update proxy.target to http://127.0.0.1:9380
2024-05-21 16:43:58 +08:00
$ npm run dev
```
8. Deploy the frontend service:
```bash
$ cd web
$ npm install --registry=https://registry.npmmirror.com --force
$ umi build
$ mkdir -p /ragflow/web
$ cp -r dist /ragflow/web
$ apt install nginx -y
$ cp ../docker/nginx/proxy.conf /etc/nginx
$ cp ../docker/nginx/nginx.conf /etc/nginx
$ cp ../docker/nginx/ragflow.conf /etc/nginx/conf.d
$ systemctl start nginx
```
2024-05-10 09:48:50 +08:00
2024-04-12 19:55:50 +08:00
## 📚 Documentation
2024-04-08 19:20:57 +08:00
2024-05-31 17:53:06 +08:00
- [Quickstart ](https://ragflow.io/docs/dev/ )
- [User guide ](https://ragflow.io/docs/dev/category/user-guides )
2024-06-07 09:06:46 +08:00
- [References ](https://ragflow.io/docs/dev/category/references )
2024-05-31 17:53:06 +08:00
- [FAQ ](https://ragflow.io/docs/dev/faq )
2024-04-08 19:20:57 +08:00
2024-03-28 17:22:02 +08:00
## 📜 Roadmap
2024-03-11 16:19:03 +08:00
2024-03-31 15:07:12 +08:00
See the [RAGFlow Roadmap 2024 ](https://github.com/infiniflow/ragflow/issues/162 )
2024-03-11 16:19:03 +08:00
2024-03-29 09:51:36 +08:00
## 🏄 Community
2024-03-11 16:19:03 +08:00
2024-04-15 10:51:32 +08:00
- [Discord ](https://discord.gg/4XxujFgUN7 )
2024-03-29 09:51:36 +08:00
- [Twitter ](https://twitter.com/infiniflowai )
2024-06-01 16:24:10 +08:00
- [GitHub Discussions ](https://github.com/orgs/infiniflow/discussions )
2024-03-11 16:19:03 +08:00
2024-03-28 17:22:02 +08:00
## 🙌 Contributing
2024-03-11 16:19:03 +08:00
2024-05-21 20:53:55 +08:00
RAGFlow flourishes via open-source collaboration. In this spirit, we embrace diverse contributions from the community. If you would like to be a part, review our [Contribution Guidelines ](./docs/references/CONTRIBUTING.md ) first.