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

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