Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.md 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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://x.com/intent/follow?screen_name=infiniflowai" target="_blank">
  14. <img src="https://img.shields.io/twitter/follow/infiniflow?logo=X&color=%20%23f5f5f5" alt="follow on X(Twitter)">
  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">
  18. </a>
  19. <a href="https://hub.docker.com/r/infiniflow/ragflow" target="_blank">
  20. <img src="https://img.shields.io/badge/docker_pull-ragflow:v0.13.0-brightgreen" alt="docker pull infiniflow/ragflow:v0.13.0">
  21. </a>
  22. <a href="https://github.com/infiniflow/ragflow/releases/latest">
  23. <img src="https://img.shields.io/github/v/release/infiniflow/ragflow?color=blue&label=Latest%20Release" alt="Latest Release">
  24. </a>
  25. <a href="https://github.com/infiniflow/ragflow/blob/main/LICENSE">
  26. <img height="21" src="https://img.shields.io/badge/License-Apache--2.0-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="license">
  27. </a>
  28. </p>
  29. <h4 align="center">
  30. <a href="https://ragflow.io/docs/dev/">Document</a> |
  31. <a href="https://github.com/infiniflow/ragflow/issues/162">Roadmap</a> |
  32. <a href="https://twitter.com/infiniflowai">Twitter</a> |
  33. <a href="https://discord.gg/4XxujFgUN7">Discord</a> |
  34. <a href="https://demo.ragflow.io">Demo</a>
  35. </h4>
  36. <details open>
  37. <summary></b>📕 Table of Contents</b></summary>
  38. - 💡 [What is RAGFlow?](#-what-is-ragflow)
  39. - 🎮 [Demo](#-demo)
  40. - 📌 [Latest Updates](#-latest-updates)
  41. - 🌟 [Key Features](#-key-features)
  42. - 🔎 [System Architecture](#-system-architecture)
  43. - 🎬 [Get Started](#-get-started)
  44. - 🔧 [Configurations](#-configurations)
  45. - 🔧 [Build a docker image without embedding models](#-build-a-docker-image-without-embedding-models)
  46. - 🔧 [Build a docker image including embedding models](#-build-a-docker-image-including-embedding-models)
  47. - 🔨 [Launch service from source for development](#-launch-service-from-source-for-development)
  48. - 📚 [Documentation](#-documentation)
  49. - 📜 [Roadmap](#-roadmap)
  50. - 🏄 [Community](#-community)
  51. - 🙌 [Contributing](#-contributing)
  52. </details>
  53. ## 💡 What is RAGFlow?
  54. [RAGFlow](https://ragflow.io/) is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document
  55. understanding. It offers a streamlined RAG workflow for businesses of any scale, combining LLM (Large Language Models)
  56. to provide truthful question-answering capabilities, backed by well-founded citations from various complex formatted
  57. data.
  58. ## 🎮 Demo
  59. Try our demo at [https://demo.ragflow.io](https://demo.ragflow.io).
  60. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  61. <img src="https://github.com/infiniflow/ragflow/assets/7248/2f6baa3e-1092-4f11-866d-36f6a9d075e5" width="1200"/>
  62. <img src="https://github.com/infiniflow/ragflow/assets/12318111/b083d173-dadc-4ea9-bdeb-180d7df514eb" width="1200"/>
  63. </div>
  64. ## 🔥 Latest Updates
  65. - 2024-09-29 Optimizes multi-round conversations.
  66. - 2024-09-13 Adds search mode for knowledge base Q&A.
  67. - 2024-09-09 Adds a medical consultant agent template.
  68. - 2024-08-22 Support text to SQL statements through RAG.
  69. - 2024-08-02 Supports GraphRAG inspired by [graphrag](https://github.com/microsoft/graphrag) and mind map.
  70. ## 🎉 Stay Tuned
  71. ⭐️ Star our repository to stay up-to-date with exciting new features and improvements! Get instant notifications for new
  72. releases! 🌟
  73. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  74. <img src="https://github.com/user-attachments/assets/18c9707e-b8aa-4caf-a154-037089c105ba" width="1200"/>
  75. </div>
  76. ## 🌟 Key Features
  77. ### 🍭 **"Quality in, quality out"**
  78. - [Deep document understanding](./deepdoc/README.md)-based knowledge extraction from unstructured data with complicated
  79. formats.
  80. - Finds "needle in a data haystack" of literally unlimited tokens.
  81. ### 🍱 **Template-based chunking**
  82. - Intelligent and explainable.
  83. - Plenty of template options to choose from.
  84. ### 🌱 **Grounded citations with reduced hallucinations**
  85. - Visualization of text chunking to allow human intervention.
  86. - Quick view of the key references and traceable citations to support grounded answers.
  87. ### 🍔 **Compatibility with heterogeneous data sources**
  88. - Supports Word, slides, excel, txt, images, scanned copies, structured data, web pages, and more.
  89. ### 🛀 **Automated and effortless RAG workflow**
  90. - Streamlined RAG orchestration catered to both personal and large businesses.
  91. - Configurable LLMs as well as embedding models.
  92. - Multiple recall paired with fused re-ranking.
  93. - Intuitive APIs for seamless integration with business.
  94. ## 🔎 System Architecture
  95. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  96. <img src="https://github.com/infiniflow/ragflow/assets/12318111/d6ac5664-c237-4200-a7c2-a4a00691b485" width="1000"/>
  97. </div>
  98. ## 🎬 Get Started
  99. ### 📝 Prerequisites
  100. - CPU >= 4 cores
  101. - RAM >= 16 GB
  102. - Disk >= 50 GB
  103. - Docker >= 24.0.0 & Docker Compose >= v2.26.1
  104. > If you have not installed Docker on your local machine (Windows, Mac, or Linux),
  105. see [Install Docker Engine](https://docs.docker.com/engine/install/).
  106. ### 🚀 Start up the server
  107. 1. Ensure `vm.max_map_count` >= 262144:
  108. > To check the value of `vm.max_map_count`:
  109. >
  110. > ```bash
  111. > $ sysctl vm.max_map_count
  112. > ```
  113. >
  114. > Reset `vm.max_map_count` to a value at least 262144 if it is not.
  115. >
  116. > ```bash
  117. > # In this case, we set it to 262144:
  118. > $ sudo sysctl -w vm.max_map_count=262144
  119. > ```
  120. >
  121. > This change will be reset after a system reboot. To ensure your change remains permanent, add or update the
  122. `vm.max_map_count` value in **/etc/sysctl.conf** accordingly:
  123. >
  124. > ```bash
  125. > vm.max_map_count=262144
  126. > ```
  127. 2. Clone the repo:
  128. ```bash
  129. $ git clone https://github.com/infiniflow/ragflow.git
  130. ```
  131. 3. Build the pre-built Docker images and start up the server:
  132. > The command below downloads the dev version Docker image for RAGFlow slim (`dev-slim`). Note that RAGFlow slim
  133. Docker images do not include embedding models or Python libraries and hence are approximately 1GB in size.
  134. ```bash
  135. $ cd ragflow/docker
  136. $ docker compose -f docker-compose.yml up -d
  137. ```
  138. > - To download a RAGFlow slim Docker image of a specific version, update the `RAGFlow_IMAGE` variable in *
  139. *docker/.env** to your desired version. For example, `RAGFLOW_IMAGE=infiniflow/ragflow:v0.13.0-slim`. After
  140. making this change, rerun the command above to initiate the download.
  141. > - To download the dev version of RAGFlow Docker image *including* embedding models and Python libraries, update the
  142. `RAGFlow_IMAGE` variable in **docker/.env** to `RAGFLOW_IMAGE=infiniflow/ragflow:dev`. After making this change,
  143. rerun the command above to initiate the download.
  144. > - To download a specific version of RAGFlow Docker image *including* embedding models and Python libraries, update
  145. the `RAGFlow_IMAGE` variable in **docker/.env** to your desired version. For example,
  146. `RAGFLOW_IMAGE=infiniflow/ragflow:v0.13.0`. After making this change, rerun the command above to initiate the
  147. download.
  148. > **NOTE:** A RAGFlow Docker image that includes embedding models and Python libraries is approximately 9GB in size
  149. and may take significantly longer time to load.
  150. 4. Check the server status after having the server up and running:
  151. ```bash
  152. $ docker logs -f ragflow-server
  153. ```
  154. _The following output confirms a successful launch of the system:_
  155. ```bash
  156. ____ ___ ______ ______ __
  157. / __ \ / | / ____// ____// /____ _ __
  158. / /_/ // /| | / / __ / /_ / // __ \| | /| / /
  159. / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ /
  160. /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/
  161. * Running on all addresses (0.0.0.0)
  162. * Running on http://127.0.0.1:9380
  163. * Running on http://x.x.x.x:9380
  164. INFO:werkzeug:Press CTRL+C to quit
  165. ```
  166. > If you skip this confirmation step and directly log in to RAGFlow, your browser may prompt a `network abnormal`
  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](./docker/service_conf.yaml), 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](./docker/service_conf.yaml): Configures the back-end services.
  180. - [docker-compose.yml](./docker/docker-compose.yml): The system relies
  181. on [docker-compose.yml](./docker/docker-compose.yml) to start up.
  182. You must ensure that changes to the [.env](./docker/.env) file are in line with what are in
  183. the [service_conf.yaml](./docker/service_conf.yaml) file.
  184. > The [./docker/README](./docker/README.md) file provides a detailed description of the environment settings and service
  185. > configurations, and you are REQUIRED to ensure that all environment settings listed in
  186. > the [./docker/README](./docker/README.md) file are aligned with the corresponding configurations in
  187. > the [service_conf.yaml](./docker/service_conf.yaml) file.
  188. To update the default HTTP serving port (80), go to [docker-compose.yml](./docker/docker-compose.yml) and change `80:80`
  189. to `<YOUR_SERVING_PORT>:80`.
  190. Updates to the above configurations require a reboot of all containers to take effect:
  191. > ```bash
  192. > $ docker compose -f docker/docker-compose.yml up -d
  193. > ```
  194. ## 🔧 Build a Docker image without embedding models
  195. This image is approximately 1 GB in size and relies on external LLM and embedding services.
  196. ```bash
  197. git clone https://github.com/infiniflow/ragflow.git
  198. cd ragflow/
  199. pip3 install huggingface-hub nltk
  200. python3 download_deps.py
  201. docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
  202. ```
  203. ## 🔧 Build a Docker image including embedding models
  204. This image is approximately 9 GB in size. As it includes embedding models, it relies on external LLM services only.
  205. ```bash
  206. git clone https://github.com/infiniflow/ragflow.git
  207. cd ragflow/
  208. pip3 install huggingface-hub nltk
  209. python3 download_deps.py
  210. docker build -f Dockerfile -t infiniflow/ragflow:dev .
  211. ```
  212. ## 🔨 Launch service from source for development
  213. 1. Install Poetry, or skip this step if it is already installed:
  214. ```bash
  215. curl -sSL https://install.python-poetry.org | python3 -
  216. ```
  217. 2. Clone the source code and install Python dependencies:
  218. ```bash
  219. git clone https://github.com/infiniflow/ragflow.git
  220. cd ragflow/
  221. export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
  222. ~/.local/bin/poetry install --sync --no-root # install RAGFlow dependent python modules
  223. ```
  224. 3. Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:
  225. ```bash
  226. docker compose -f docker/docker-compose-base.yml up -d
  227. ```
  228. Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/service_conf.yaml** to `127.0.0.1`:
  229. ```
  230. 127.0.0.1 es01 mysql minio redis
  231. ```
  232. In **docker/service_conf.yaml**, update mysql port to `5455` and es port to `1200`, as specified in **docker/.env**.
  233. 4. If you cannot access HuggingFace, set the `HF_ENDPOINT` environment variable to use a mirror site:
  234. ```bash
  235. export HF_ENDPOINT=https://hf-mirror.com
  236. ```
  237. 5. Launch backend service:
  238. ```bash
  239. source .venv/bin/activate
  240. export PYTHONPATH=$(pwd)
  241. bash docker/launch_backend_service.sh
  242. ```
  243. 6. Install frontend dependencies:
  244. ```bash
  245. cd web
  246. npm install --force
  247. ```
  248. 7. Configure frontend to update `proxy.target` in **.umirc.ts** to `http://127.0.0.1:9380`:
  249. 8. Launch frontend service:
  250. ```bash
  251. npm run dev
  252. ```
  253. _The following output confirms a successful launch of the system:_
  254. ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187)
  255. ## 📚 Documentation
  256. - [Quickstart](https://ragflow.io/docs/dev/)
  257. - [User guide](https://ragflow.io/docs/dev/category/guides)
  258. - [References](https://ragflow.io/docs/dev/category/references)
  259. - [FAQ](https://ragflow.io/docs/dev/faq)
  260. ## 📜 Roadmap
  261. See the [RAGFlow Roadmap 2024](https://github.com/infiniflow/ragflow/issues/162)
  262. ## 🏄 Community
  263. - [Discord](https://discord.gg/4XxujFgUN7)
  264. - [Twitter](https://twitter.com/infiniflowai)
  265. - [GitHub Discussions](https://github.com/orgs/infiniflow/discussions)
  266. ## 🙌 Contributing
  267. RAGFlow flourishes via open-source collaboration. In this spirit, we embrace diverse contributions from the community.
  268. If you would like to be a part, review our [Contribution Guidelines](./CONTRIBUTING.md) first.