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 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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_ja.md">日本語</a>
  10. </p>
  11. <p align="center">
  12. <a href="https://github.com/infiniflow/ragflow/releases/latest">
  13. <img src="https://img.shields.io/github/v/release/infiniflow/ragflow?color=blue&label=Latest%20Release" alt="Latest Release">
  14. </a>
  15. <a href="https://demo.ragflow.io" target="_blank">
  16. <img alt="Static Badge" src="https://img.shields.io/badge/Online-Demo-4e6b99"></a>
  17. <a href="https://hub.docker.com/r/infiniflow/ragflow" target="_blank">
  18. <img src="https://img.shields.io/badge/docker_pull-ragflow:v0.7.0-brightgreen" alt="docker pull infiniflow/ragflow:v0.7.0"></a>
  19. <a href="https://github.com/infiniflow/ragflow/blob/main/LICENSE">
  20. <img height="21" src="https://img.shields.io/badge/License-Apache--2.0-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="license">
  21. </a>
  22. </p>
  23. <h4 align="center">
  24. <a href="https://ragflow.io/docs/dev/">Document</a> |
  25. <a href="https://github.com/infiniflow/ragflow/issues/162">Roadmap</a> |
  26. <a href="https://twitter.com/infiniflowai">Twitter</a> |
  27. <a href="https://discord.gg/jEfRUwEYEV">Discord</a> |
  28. <a href="https://demo.ragflow.io">Demo</a>
  29. </h4>
  30. <details open>
  31. <summary></b>📕 Table of Contents</b></summary>
  32. - 💡 [What is RAGFlow?](#-what-is-ragflow)
  33. - 🎮 [Demo](#-demo)
  34. - 📌 [Latest Updates](#-latest-updates)
  35. - 🌟 [Key Features](#-key-features)
  36. - 🔎 [System Architecture](#-system-architecture)
  37. - 🎬 [Get Started](#-get-started)
  38. - 🔧 [Configurations](#-configurations)
  39. - 🛠️ [Build from source](#-build-from-source)
  40. - 🛠️ [Launch service from source](#-launch-service-from-source)
  41. - 📚 [Documentation](#-documentation)
  42. - 📜 [Roadmap](#-roadmap)
  43. - 🏄 [Community](#-community)
  44. - 🙌 [Contributing](#-contributing)
  45. </details>
  46. ## 💡 What is RAGFlow?
  47. [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.
  48. ## 🎮 Demo
  49. Try our demo at [https://demo.ragflow.io](https://demo.ragflow.io).
  50. ## 📌 Latest Updates
  51. - 2024-06-06 Supports [Self-RAG](https://huggingface.co/papers/2310.11511), which is enabled by default in dialog settings.
  52. - 2024-05-30 Integrates [BCE](https://github.com/netease-youdao/BCEmbedding) and [BGE](https://github.com/FlagOpen/FlagEmbedding) reranker models.
  53. - 2024-05-28 Supports LLM Baichuan and VolcanoArk.
  54. - 2024-05-23 Supports [RAPTOR](https://arxiv.org/html/2401.18059v1) for better text retrieval.
  55. - 2024-05-21 Supports streaming output and text chunk retrieval API.
  56. - 2024-05-15 Integrates OpenAI GPT-4o.
  57. - 2024-05-08 Integrates LLM DeepSeek-V2.
  58. ## 🌟 Key Features
  59. ### 🍭 **"Quality in, quality out"**
  60. - [Deep document understanding](./deepdoc/README.md)-based knowledge extraction from unstructured data with complicated formats.
  61. - Finds "needle in a data haystack" of literally unlimited tokens.
  62. ### 🍱 **Template-based chunking**
  63. - Intelligent and explainable.
  64. - Plenty of template options to choose from.
  65. ### 🌱 **Grounded citations with reduced hallucinations**
  66. - Visualization of text chunking to allow human intervention.
  67. - Quick view of the key references and traceable citations to support grounded answers.
  68. ### 🍔 **Compatibility with heterogeneous data sources**
  69. - Supports Word, slides, excel, txt, images, scanned copies, structured data, web pages, and more.
  70. ### 🛀 **Automated and effortless RAG workflow**
  71. - Streamlined RAG orchestration catered to both personal and large businesses.
  72. - Configurable LLMs as well as embedding models.
  73. - Multiple recall paired with fused re-ranking.
  74. - Intuitive APIs for seamless integration with business.
  75. ## 🔎 System Architecture
  76. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  77. <img src="https://github.com/infiniflow/ragflow/assets/12318111/d6ac5664-c237-4200-a7c2-a4a00691b485" width="1000"/>
  78. </div>
  79. ## 🎬 Get Started
  80. ### 📝 Prerequisites
  81. - CPU >= 4 cores
  82. - RAM >= 16 GB
  83. - Disk >= 50 GB
  84. - Docker >= 24.0.0 & Docker Compose >= v2.26.1
  85. > If you have not installed Docker on your local machine (Windows, Mac, or Linux), see [Install Docker Engine](https://docs.docker.com/engine/install/).
  86. ### 🚀 Start up the server
  87. 1. Ensure `vm.max_map_count` >= 262144:
  88. > To check the value of `vm.max_map_count`:
  89. >
  90. > ```bash
  91. > $ sysctl vm.max_map_count
  92. > ```
  93. >
  94. > Reset `vm.max_map_count` to a value at least 262144 if it is not.
  95. >
  96. > ```bash
  97. > # In this case, we set it to 262144:
  98. > $ sudo sysctl -w vm.max_map_count=262144
  99. > ```
  100. >
  101. > 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:
  102. >
  103. > ```bash
  104. > vm.max_map_count=262144
  105. > ```
  106. 2. Clone the repo:
  107. ```bash
  108. $ git clone https://github.com/infiniflow/ragflow.git
  109. ```
  110. 3. Build the pre-built Docker images and start up the server:
  111. > 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.7.0`, before running the following commands.
  112. ```bash
  113. $ cd ragflow/docker
  114. $ chmod +x ./entrypoint.sh
  115. $ docker compose up -d
  116. ```
  117. > The core image is about 9 GB in size and may take a while to load.
  118. 4. Check the server status after having the server up and running:
  119. ```bash
  120. $ docker logs -f ragflow-server
  121. ```
  122. _The following output confirms a successful launch of the system:_
  123. ```bash
  124. ____ ______ __
  125. / __ \ ____ _ ____ _ / ____// /____ _ __
  126. / /_/ // __ `// __ `// /_ / // __ \| | /| / /
  127. / _, _// /_/ // /_/ // __/ / // /_/ /| |/ |/ /
  128. /_/ |_| \__,_/ \__, //_/ /_/ \____/ |__/|__/
  129. /____/
  130. * Running on all addresses (0.0.0.0)
  131. * Running on http://127.0.0.1:9380
  132. * Running on http://x.x.x.x:9380
  133. INFO:werkzeug:Press CTRL+C to quit
  134. ```
  135. > 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.
  136. 5. In your web browser, enter the IP address of your server and log in to RAGFlow.
  137. > With 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.
  138. 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.
  139. > See [llm_api_key_setup](https://ragflow.io/docs/dev/llm_api_key_setup) for more information.
  140. _The show is now on!_
  141. ## 🔧 Configurations
  142. When it comes to system configurations, you will need to manage the following files:
  143. - [.env](./docker/.env): Keeps the fundamental setups for the system, such as `SVR_HTTP_PORT`, `MYSQL_PASSWORD`, and `MINIO_PASSWORD`.
  144. - [service_conf.yaml](./docker/service_conf.yaml): Configures the back-end services.
  145. - [docker-compose.yml](./docker/docker-compose.yml): The system relies on [docker-compose.yml](./docker/docker-compose.yml) to start up.
  146. 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.
  147. > 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.
  148. 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`.
  149. > Updates to all system configurations require a system reboot to take effect:
  150. >
  151. > ```bash
  152. > $ docker-compose up -d
  153. > ```
  154. ## 🛠️ Build from source
  155. To build the Docker images from source:
  156. ```bash
  157. $ git clone https://github.com/infiniflow/ragflow.git
  158. $ cd ragflow/
  159. $ docker build -t infiniflow/ragflow:dev .
  160. $ cd ragflow/docker
  161. $ chmod +x ./entrypoint.sh
  162. $ docker compose up -d
  163. ```
  164. ## 🛠️ Launch service from source
  165. To launch the service from source:
  166. 1. Clone the repository:
  167. ```bash
  168. $ git clone https://github.com/infiniflow/ragflow.git
  169. $ cd ragflow/
  170. ```
  171. 2. Create a virtual environment, ensuring that Anaconda or Miniconda is installed:
  172. ```bash
  173. $ conda create -n ragflow python=3.11.0
  174. $ conda activate ragflow
  175. $ pip install -r requirements.txt
  176. ```
  177. ```bash
  178. # If your CUDA version is higher than 12.0, run the following additional commands:
  179. $ pip uninstall -y onnxruntime-gpu
  180. $ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
  181. ```
  182. 3. Copy the entry script and configure environment variables:
  183. ```bash
  184. # Get the Python path:
  185. $ which python
  186. # Get the ragflow project path:
  187. $ pwd
  188. ```
  189. ```bash
  190. $ cp docker/entrypoint.sh .
  191. $ vi entrypoint.sh
  192. ```
  193. ```bash
  194. # Adjust configurations according to your actual situation (the following two export commands are newly added):
  195. # - Assign the result of `which python` to `PY`.
  196. # - Assign the result of `pwd` to `PYTHONPATH`.
  197. # - Comment out `LD_LIBRARY_PATH`, if it is configured.
  198. # - Optional: Add Hugging Face mirror.
  199. PY=${PY}
  200. export PYTHONPATH=${PYTHONPATH}
  201. export HF_ENDPOINT=https://hf-mirror.com
  202. ```
  203. 4. Launch the third-party services (MinIO, Elasticsearch, Redis, and MySQL):
  204. ```bash
  205. $ cd docker
  206. $ docker compose -f docker-compose-base.yml up -d
  207. ```
  208. 5. Check the configuration files, ensuring that:
  209. - The settings in **docker/.env** match those in **conf/service_conf.yaml**.
  210. - The IP addresses and ports for related services in **service_conf.yaml** match the local machine IP and ports exposed by the container.
  211. 6. Launch the RAGFlow backend service:
  212. ```bash
  213. $ chmod +x ./entrypoint.sh
  214. $ bash ./entrypoint.sh
  215. ```
  216. 7. Launch the frontend service:
  217. ```bash
  218. $ cd web
  219. $ npm install --registry=https://registry.npmmirror.com --force
  220. $ vim .umirc.ts
  221. # Update proxy.target to 127.0.0.1:9380
  222. $ npm run dev
  223. ```
  224. 8. Deploy the frontend service:
  225. ```bash
  226. $ cd web
  227. $ npm install --registry=https://registry.npmmirror.com --force
  228. $ umi build
  229. $ mkdir -p /ragflow/web
  230. $ cp -r dist /ragflow/web
  231. $ apt install nginx -y
  232. $ cp ../docker/nginx/proxy.conf /etc/nginx
  233. $ cp ../docker/nginx/nginx.conf /etc/nginx
  234. $ cp ../docker/nginx/ragflow.conf /etc/nginx/conf.d
  235. $ systemctl start nginx
  236. ```
  237. ## 📚 Documentation
  238. - [Quickstart](https://ragflow.io/docs/dev/)
  239. - [User guide](https://ragflow.io/docs/dev/category/user-guides)
  240. - [References](https://ragflow.io/docs/dev/category/references)
  241. - [FAQ](https://ragflow.io/docs/dev/faq)
  242. ## 📜 Roadmap
  243. See the [RAGFlow Roadmap 2024](https://github.com/infiniflow/ragflow/issues/162)
  244. ## 🏄 Community
  245. - [Discord](https://discord.gg/4XxujFgUN7)
  246. - [Twitter](https://twitter.com/infiniflowai)
  247. - [GitHub Discussions](https://github.com/orgs/infiniflow/discussions)
  248. ## 🙌 Contributing
  249. 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.