You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <div align="center">
  2. <a href="https://demo.ragflow.io/">
  3. <img src="web/src/assets/logo-with-text.png" width="520" alt="ragflow logo">
  4. </a>
  5. </div>
  6. <p align="center">
  7. <a href="./README.md">English</a> |
  8. <a href="./README_zh.md">简体中文</a> |
  9. <a href="./README_tzh.md">繁体中文</a> |
  10. <a href="./README_ja.md">日本語</a> |
  11. <a href="./README_ko.md">한국어</a> |
  12. <a href="./README_id.md">Bahasa Indonesia</a> |
  13. <a href="/README_pt_br.md">Português (Brasil)</a>
  14. </p>
  15. <p align="center">
  16. <a href="https://x.com/intent/follow?screen_name=infiniflowai" target="_blank">
  17. <img src="https://img.shields.io/twitter/follow/infiniflow?logo=X&color=%20%23f5f5f5" alt="follow on X(Twitter)">
  18. </a>
  19. <a href="https://demo.ragflow.io" target="_blank">
  20. <img alt="Static Badge" src="https://img.shields.io/badge/Online-Demo-4e6b99">
  21. </a>
  22. <a href="https://hub.docker.com/r/infiniflow/ragflow" target="_blank">
  23. <img src="https://img.shields.io/badge/docker_pull-ragflow:v0.18.0-brightgreen" alt="docker pull infiniflow/ragflow:v0.18.0">
  24. </a>
  25. <a href="https://github.com/infiniflow/ragflow/releases/latest">
  26. <img src="https://img.shields.io/github/v/release/infiniflow/ragflow?color=blue&label=Latest%20Release" alt="Latest Release">
  27. </a>
  28. <a href="https://github.com/infiniflow/ragflow/blob/main/LICENSE">
  29. <img height="21" src="https://img.shields.io/badge/License-Apache--2.0-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="license">
  30. </a>
  31. </p>
  32. <h4 align="center">
  33. <a href="https://ragflow.io/docs/dev/">Document</a> |
  34. <a href="https://github.com/infiniflow/ragflow/issues/4214">Roadmap</a> |
  35. <a href="https://twitter.com/infiniflowai">Twitter</a> |
  36. <a href="https://discord.gg/NjYzJD3GM3">Discord</a> |
  37. <a href="https://demo.ragflow.io">Demo</a>
  38. </h4>
  39. <details open>
  40. <summary><b>📕 Table of Contents</b></summary>
  41. - 💡 [What is RAGFlow?](#-what-is-ragflow)
  42. - 🎮 [Demo](#-demo)
  43. - 📌 [Latest Updates](#-latest-updates)
  44. - 🌟 [Key Features](#-key-features)
  45. - 🔎 [System Architecture](#-system-architecture)
  46. - 🎬 [Get Started](#-get-started)
  47. - 🔧 [Configurations](#-configurations)
  48. - 🔧 [Build a docker image without embedding models](#-build-a-docker-image-without-embedding-models)
  49. - 🔧 [Build a docker image including embedding models](#-build-a-docker-image-including-embedding-models)
  50. - 🔨 [Launch service from source for development](#-launch-service-from-source-for-development)
  51. - 📚 [Documentation](#-documentation)
  52. - 📜 [Roadmap](#-roadmap)
  53. - 🏄 [Community](#-community)
  54. - 🙌 [Contributing](#-contributing)
  55. </details>
  56. ## 💡 What is RAGFlow?
  57. [RAGFlow](https://ragflow.io/) is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document
  58. understanding. It offers a streamlined RAG workflow for businesses of any scale, combining LLM (Large Language Models)
  59. to provide truthful question-answering capabilities, backed by well-founded citations from various complex formatted
  60. data.
  61. ## 🎮 Demo
  62. Try our demo at [https://demo.ragflow.io](https://demo.ragflow.io).
  63. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  64. <img src="https://github.com/infiniflow/ragflow/assets/7248/2f6baa3e-1092-4f11-866d-36f6a9d075e5" width="1200"/>
  65. <img src="https://github.com/user-attachments/assets/504bbbf1-c9f7-4d83-8cc5-e9cb63c26db6" width="1200"/>
  66. </div>
  67. ## 🔥 Latest Updates
  68. - 2025-03-19 Supports using a multi-modal model to make sense of images within PDF or DOCX files.
  69. - 2025-02-28 Combined with Internet search (Tavily), supports reasoning like Deep Research for any LLMs.
  70. - 2025-01-26 Optimizes knowledge graph extraction and application, offering various configuration options.
  71. - 2024-12-18 Upgrades Document Layout Analysis model in DeepDoc.
  72. - 2024-11-01 Adds keyword extraction and related question generation to the parsed chunks to improve the accuracy of retrieval.
  73. - 2024-08-22 Support text to SQL statements through RAG.
  74. ## 🎉 Stay Tuned
  75. ⭐️ Star our repository to stay up-to-date with exciting new features and improvements! Get instant notifications for new
  76. releases! 🌟
  77. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  78. <img src="https://github.com/user-attachments/assets/18c9707e-b8aa-4caf-a154-037089c105ba" width="1200"/>
  79. </div>
  80. ## 🌟 Key Features
  81. ### 🍭 **"Quality in, quality out"**
  82. - [Deep document understanding](./deepdoc/README.md)-based knowledge extraction from unstructured data with complicated
  83. formats.
  84. - Finds "needle in a data haystack" of literally unlimited tokens.
  85. ### 🍱 **Template-based chunking**
  86. - Intelligent and explainable.
  87. - Plenty of template options to choose from.
  88. ### 🌱 **Grounded citations with reduced hallucinations**
  89. - Visualization of text chunking to allow human intervention.
  90. - Quick view of the key references and traceable citations to support grounded answers.
  91. ### 🍔 **Compatibility with heterogeneous data sources**
  92. - Supports Word, slides, excel, txt, images, scanned copies, structured data, web pages, and more.
  93. ### 🛀 **Automated and effortless RAG workflow**
  94. - Streamlined RAG orchestration catered to both personal and large businesses.
  95. - Configurable LLMs as well as embedding models.
  96. - Multiple recall paired with fused re-ranking.
  97. - Intuitive APIs for seamless integration with business.
  98. ## 🔎 System Architecture
  99. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  100. <img src="https://github.com/infiniflow/ragflow/assets/12318111/d6ac5664-c237-4200-a7c2-a4a00691b485" width="1000"/>
  101. </div>
  102. ## 🎬 Get Started
  103. ### 📝 Prerequisites
  104. - CPU >= 4 cores
  105. - RAM >= 16 GB
  106. - Disk >= 50 GB
  107. - Docker >= 24.0.0 & Docker Compose >= v2.26.1
  108. > If you have not installed Docker on your local machine (Windows, Mac, or Linux),
  109. > see [Install Docker Engine](https://docs.docker.com/engine/install/).
  110. ### 🚀 Start up the server
  111. 1. Ensure `vm.max_map_count` >= 262144:
  112. > To check the value of `vm.max_map_count`:
  113. >
  114. > ```bash
  115. > $ sysctl vm.max_map_count
  116. > ```
  117. >
  118. > Reset `vm.max_map_count` to a value at least 262144 if it is not.
  119. >
  120. > ```bash
  121. > # In this case, we set it to 262144:
  122. > $ sudo sysctl -w vm.max_map_count=262144
  123. > ```
  124. >
  125. > This change will be reset after a system reboot. To ensure your change remains permanent, add or update the
  126. > `vm.max_map_count` value in **/etc/sysctl.conf** accordingly:
  127. >
  128. > ```bash
  129. > vm.max_map_count=262144
  130. > ```
  131. 2. Clone the repo:
  132. ```bash
  133. $ git clone https://github.com/infiniflow/ragflow.git
  134. ```
  135. 3. Start up the server using the pre-built Docker images:
  136. > [!CAUTION]
  137. > All Docker images are built for x86 platforms. We don't currently offer Docker images for ARM64.
  138. > If you are on an ARM64 platform, follow [this guide](https://ragflow.io/docs/dev/build_docker_image) to build a Docker image compatible with your system.
  139. > The command below downloads the `v0.18.0-slim` edition of the RAGFlow Docker image. See the following table for descriptions of different RAGFlow editions. To download a RAGFlow edition different from `v0.18.0-slim`, update the `RAGFLOW_IMAGE` variable accordingly in **docker/.env** before using `docker compose` to start the server. For example: set `RAGFLOW_IMAGE=infiniflow/ragflow:v0.18.0` for the full edition `v0.18.0`.
  140. ```bash
  141. $ cd ragflow/docker
  142. # Use CPU for embedding and DeepDoc tasks:
  143. $ docker compose -f docker-compose.yml up -d
  144. # To use GPU to accelerate embedding and DeepDoc tasks:
  145. # docker compose -f docker-compose-gpu.yml up -d
  146. ```
  147. | RAGFlow image tag | Image size (GB) | Has embedding models? | Stable? |
  148. |-------------------|-----------------|-----------------------|--------------------------|
  149. | v0.18.0 | &approx;9 | :heavy_check_mark: | Stable release |
  150. | v0.18.0-slim | &approx;2 | ❌ | Stable release |
  151. | nightly | &approx;9 | :heavy_check_mark: | _Unstable_ nightly build |
  152. | nightly-slim | &approx;2 | ❌ | _Unstable_ nightly build |
  153. 4. Check the server status after having the server up and running:
  154. ```bash
  155. $ docker logs -f ragflow-server
  156. ```
  157. _The following output confirms a successful launch of the system:_
  158. ```bash
  159. ____ ___ ______ ______ __
  160. / __ \ / | / ____// ____// /____ _ __
  161. / /_/ // /| | / / __ / /_ / // __ \| | /| / /
  162. / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ /
  163. /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/
  164. * Running on all addresses (0.0.0.0)
  165. ```
  166. > If you skip this confirmation step and directly log in to RAGFlow, your browser may prompt a `network anormal`
  167. > error because, at that moment, your RAGFlow may not be fully initialized.
  168. 5. In your web browser, enter the IP address of your server and log in to RAGFlow.
  169. > With the default settings, you only need to enter `http://IP_OF_YOUR_MACHINE` (**sans** port number) as the default
  170. > HTTP serving port `80` can be omitted when using the default configurations.
  171. 6. In [service_conf.yaml.template](./docker/service_conf.yaml.template), select the desired LLM factory in `user_default_llm` and update
  172. the `API_KEY` field with the corresponding API key.
  173. > See [llm_api_key_setup](https://ragflow.io/docs/dev/llm_api_key_setup) for more information.
  174. _The show is on!_
  175. ## 🔧 Configurations
  176. When it comes to system configurations, you will need to manage the following files:
  177. - [.env](./docker/.env): Keeps the fundamental setups for the system, such as `SVR_HTTP_PORT`, `MYSQL_PASSWORD`, and
  178. `MINIO_PASSWORD`.
  179. - [service_conf.yaml.template](./docker/service_conf.yaml.template): Configures the back-end services. The environment variables in this file will be automatically populated when the Docker container starts. Any environment variables set within the Docker container will be available for use, allowing you to customize service behavior based on the deployment environment.
  180. - [docker-compose.yml](./docker/docker-compose.yml): The system relies on [docker-compose.yml](./docker/docker-compose.yml) to start up.
  181. > The [./docker/README](./docker/README.md) file provides a detailed description of the environment settings and service
  182. > configurations which can be used as `${ENV_VARS}` in the [service_conf.yaml.template](./docker/service_conf.yaml.template) file.
  183. To update the default HTTP serving port (80), go to [docker-compose.yml](./docker/docker-compose.yml) and change `80:80`
  184. to `<YOUR_SERVING_PORT>:80`.
  185. Updates to the above configurations require a reboot of all containers to take effect:
  186. > ```bash
  187. > $ docker compose -f docker-compose.yml up -d
  188. > ```
  189. ### Switch doc engine from Elasticsearch to Infinity
  190. RAGFlow uses Elasticsearch by default for storing full text and vectors. To switch to [Infinity](https://github.com/infiniflow/infinity/), follow these steps:
  191. 1. Stop all running containers:
  192. ```bash
  193. $ docker compose -f docker/docker-compose.yml down -v
  194. ```
  195. > [!WARNING]
  196. > `-v` will delete the docker container volumes, and the existing data will be cleared.
  197. 2. Set `DOC_ENGINE` in **docker/.env** to `infinity`.
  198. 3. Start the containers:
  199. ```bash
  200. $ docker compose -f docker-compose.yml up -d
  201. ```
  202. > [!WARNING]
  203. > Switching to Infinity on a Linux/arm64 machine is not yet officially supported.
  204. ## 🔧 Build a Docker image without embedding models
  205. This image is approximately 2 GB in size and relies on external LLM and embedding services.
  206. ```bash
  207. git clone https://github.com/infiniflow/ragflow.git
  208. cd ragflow/
  209. docker build --platform linux/amd64 --build-arg LIGHTEN=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim .
  210. ```
  211. ## 🔧 Build a Docker image including embedding models
  212. This image is approximately 9 GB in size. As it includes embedding models, it relies on external LLM services only.
  213. ```bash
  214. git clone https://github.com/infiniflow/ragflow.git
  215. cd ragflow/
  216. docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly .
  217. ```
  218. ## 🔨 Launch service from source for development
  219. 1. Install uv, or skip this step if it is already installed:
  220. ```bash
  221. pipx install uv
  222. ```
  223. 2. Clone the source code and install Python dependencies:
  224. ```bash
  225. git clone https://github.com/infiniflow/ragflow.git
  226. cd ragflow/
  227. uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
  228. ```
  229. 3. Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:
  230. ```bash
  231. docker compose -f docker/docker-compose-base.yml up -d
  232. ```
  233. Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/.env** to `127.0.0.1`:
  234. ```
  235. 127.0.0.1 es01 infinity mysql minio redis
  236. ```
  237. 4. If you cannot access HuggingFace, set the `HF_ENDPOINT` environment variable to use a mirror site:
  238. ```bash
  239. export HF_ENDPOINT=https://hf-mirror.com
  240. ```
  241. 5. Launch backend service:
  242. ```bash
  243. source .venv/bin/activate
  244. export PYTHONPATH=$(pwd)
  245. bash docker/launch_backend_service.sh
  246. ```
  247. 6. Install frontend dependencies:
  248. ```bash
  249. cd web
  250. npm install
  251. ```
  252. 7. Launch frontend service:
  253. ```bash
  254. npm run dev
  255. ```
  256. _The following output confirms a successful launch of the system:_
  257. ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187)
  258. ## 📚 Documentation
  259. - [Quickstart](https://ragflow.io/docs/dev/)
  260. - [Configuration](https://ragflow.io/docs/dev/configurations)
  261. - [Release notes](https://ragflow.io/docs/dev/release_notes)
  262. - [User guides](https://ragflow.io/docs/dev/category/guides)
  263. - [Developer guides](https://ragflow.io/docs/dev/category/developers)
  264. - [References](https://ragflow.io/docs/dev/category/references)
  265. - [FAQs](https://ragflow.io/docs/dev/faq)
  266. ## 📜 Roadmap
  267. See the [RAGFlow Roadmap 2025](https://github.com/infiniflow/ragflow/issues/4214)
  268. ## 🏄 Community
  269. - [Discord](https://discord.gg/NjYzJD3GM3)
  270. - [Twitter](https://twitter.com/infiniflowai)
  271. - [GitHub Discussions](https://github.com/orgs/infiniflow/discussions)
  272. ## 🙌 Contributing
  273. RAGFlow flourishes via open-source collaboration. In this spirit, we embrace diverse contributions from the community.
  274. If you would like to be a part, review our [Contribution Guidelines](./CONTRIBUTING.md) first.