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

1 yıl önce
1 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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.5.0-brightgreen"
  19. alt="docker pull infiniflow/ragflow:v0.5.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?style=flat-square&labelColor=d4eaf7&color=1570EF" alt="license">
  22. </a>
  23. </p>
  24. ## 💡 What is RAGFlow?
  25. [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.
  26. ## 📌 Latest Updates
  27. - 2024-05-15 Integrates OpenAI GPT-4o.
  28. - 2024-05-08 Integrates LLM DeepSeek-V2.
  29. - 2024-04-26 Adds file management.
  30. - 2024-04-19 Supports conversation API ([detail](./docs/conversation_api.md)).
  31. - 2024-04-16 Integrates an embedding model 'bce-embedding-base_v1' from [BCEmbedding](https://github.com/netease-youdao/BCEmbedding), and [FastEmbed](https://github.com/qdrant/fastembed), which is designed specifically for light and speedy embedding.
  32. - 2024-04-11 Supports [Xinference](./docs/xinference.md) for local LLM deployment.
  33. - 2024-04-10 Adds a new layout recognition model for analyzing legal documents.
  34. - 2024-04-08 Supports [Ollama](./docs/ollama.md) for local LLM deployment.
  35. - 2024-04-07 Supports Chinese UI.
  36. ## 🌟 Key Features
  37. ### 🍭 **"Quality in, quality out"**
  38. - [Deep document understanding](./deepdoc/README.md)-based knowledge extraction from unstructured data with complicated formats.
  39. - Finds "needle in a data haystack" of literally unlimited tokens.
  40. ### 🍱 **Template-based chunking**
  41. - Intelligent and explainable.
  42. - Plenty of template options to choose from.
  43. ### 🌱 **Grounded citations with reduced hallucinations**
  44. - Visualization of text chunking to allow human intervention.
  45. - Quick view of the key references and traceable citations to support grounded answers.
  46. ### 🍔 **Compatibility with heterogeneous data sources**
  47. - Supports Word, slides, excel, txt, images, scanned copies, structured data, web pages, and more.
  48. ### 🛀 **Automated and effortless RAG workflow**
  49. - Streamlined RAG orchestration catered to both personal and large businesses.
  50. - Configurable LLMs as well as embedding models.
  51. - Multiple recall paired with fused re-ranking.
  52. - Intuitive APIs for seamless integration with business.
  53. ## 🔎 System Architecture
  54. <div align="center" style="margin-top:20px;margin-bottom:20px;">
  55. <img src="https://github.com/infiniflow/ragflow/assets/12318111/d6ac5664-c237-4200-a7c2-a4a00691b485" width="1000"/>
  56. </div>
  57. ## 🎬 Get Started
  58. ### 📝 Prerequisites
  59. - CPU >= 4 cores
  60. - RAM >= 16 GB
  61. - Disk >= 50 GB
  62. - Docker >= 24.0.0 & Docker Compose >= v2.26.1
  63. > If you have not installed Docker on your local machine (Windows, Mac, or Linux), see [Install Docker Engine](https://docs.docker.com/engine/install/).
  64. ### 🚀 Start up the server
  65. 1. Ensure `vm.max_map_count` >= 262144 ([more](./docs/max_map_count.md)):
  66. > To check the value of `vm.max_map_count`:
  67. >
  68. > ```bash
  69. > $ sysctl vm.max_map_count
  70. > ```
  71. >
  72. > Reset `vm.max_map_count` to a value at least 262144 if it is not.
  73. >
  74. > ```bash
  75. > # In this case, we set it to 262144:
  76. > $ sudo sysctl -w vm.max_map_count=262144
  77. > ```
  78. >
  79. > 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:
  80. >
  81. > ```bash
  82. > vm.max_map_count=262144
  83. > ```
  84. 2. Clone the repo:
  85. ```bash
  86. $ git clone https://github.com/infiniflow/ragflow.git
  87. ```
  88. 3. Build the pre-built Docker images and start up the server:
  89. > 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.5.0`, before running the following commands.
  90. ```bash
  91. $ cd ragflow/docker
  92. $ chmod +x ./entrypoint.sh
  93. $ docker compose up -d
  94. ```
  95. > The core image is about 9 GB in size and may take a while to load.
  96. 4. Check the server status after having the server up and running:
  97. ```bash
  98. $ docker logs -f ragflow-server
  99. ```
  100. _The following output confirms a successful launch of the system:_
  101. ```bash
  102. ____ ______ __
  103. / __ \ ____ _ ____ _ / ____// /____ _ __
  104. / /_/ // __ `// __ `// /_ / // __ \| | /| / /
  105. / _, _// /_/ // /_/ // __/ / // /_/ /| |/ |/ /
  106. /_/ |_| \__,_/ \__, //_/ /_/ \____/ |__/|__/
  107. /____/
  108. * Running on all addresses (0.0.0.0)
  109. * Running on http://127.0.0.1:9380
  110. * Running on http://x.x.x.x:9380
  111. INFO:werkzeug:Press CTRL+C to quit
  112. ```
  113. > 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.
  114. 5. In your web browser, enter the IP address of your server and log in to RAGFlow.
  115. > 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.
  116. 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.
  117. > See [./docs/llm_api_key_setup.md](./docs/llm_api_key_setup.md) for more information.
  118. _The show is now on!_
  119. ## 🔧 Configurations
  120. When it comes to system configurations, you will need to manage the following files:
  121. - [.env](./docker/.env): Keeps the fundamental setups for the system, such as `SVR_HTTP_PORT`, `MYSQL_PASSWORD`, and `MINIO_PASSWORD`.
  122. - [service_conf.yaml](./docker/service_conf.yaml): Configures the back-end services.
  123. - [docker-compose.yml](./docker/docker-compose.yml): The system relies on [docker-compose.yml](./docker/docker-compose.yml) to start up.
  124. 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.
  125. > 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.
  126. 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`.
  127. > Updates to all system configurations require a system reboot to take effect:
  128. >
  129. > ```bash
  130. > $ docker-compose up -d
  131. > ```
  132. ## 🛠️ Build from source
  133. To build the Docker images from source:
  134. ```bash
  135. $ git clone https://github.com/infiniflow/ragflow.git
  136. $ cd ragflow/
  137. $ docker build -t infiniflow/ragflow:dev .
  138. $ cd ragflow/docker
  139. $ chmod +x ./entrypoint.sh
  140. $ docker compose up -d
  141. ```
  142. ## 🛠️ Launch Service from Source
  143. To launch the service from source, please follow these steps:
  144. 1. Clone the repository
  145. ```bash
  146. $ git clone https://github.com/infiniflow/ragflow.git
  147. $ cd ragflow/
  148. ```
  149. 2. Create a virtual environment (ensure Anaconda or Miniconda is installed)
  150. ```bash
  151. $ conda create -n ragflow python=3.11.0
  152. $ conda activate ragflow
  153. $ pip install -r requirements.txt
  154. ```
  155. If CUDA version is greater than 12.0, execute the following additional commands:
  156. ```bash
  157. $ pip uninstall -y onnxruntime-gpu
  158. $ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
  159. ```
  160. 3. Copy the entry script and configure environment variables
  161. ```bash
  162. $ cp docker/entrypoint.sh .
  163. $ vi entrypoint.sh
  164. ```
  165. Use the following commands to obtain the Python path and the ragflow project path:
  166. ```bash
  167. $ which python
  168. $ pwd
  169. ```
  170. Set the output of `which python` as the value for `PY` and the output of `pwd` as the value for `PYTHONPATH`.
  171. If `LD_LIBRARY_PATH` is already configured, it can be commented out.
  172. ```bash
  173. # Adjust configurations according to your actual situation; the two export commands are newly added.
  174. PY=${PY}
  175. export PYTHONPATH=${PYTHONPATH}
  176. # Optional: Add Hugging Face mirror
  177. export HF_ENDPOINT=https://hf-mirror.com
  178. ```
  179. 4. Start the base services
  180. ```bash
  181. $ cd docker
  182. $ docker compose -f docker-compose-base.yml up -d
  183. ```
  184. 5. Check the configuration files
  185. Ensure that the settings in **docker/.env** match those in **conf/service_conf.yaml**. The IP addresses and ports for related services in **service_conf.yaml** should be changed to the local machine IP and ports exposed by the container.
  186. 6. Launch the service
  187. ```bash
  188. $ chmod +x ./entrypoint.sh
  189. $ bash ./entrypoint.sh
  190. ```
  191. 7. Start the WebUI service
  192. ```bash
  193. $ cd web
  194. $ npm install --registry=https://registry.npmmirror.com --force
  195. $ vim .umirc.ts
  196. # Modify proxy.target to 127.0.0.1:9380
  197. $ npm run dev
  198. ```
  199. 8. Deploy the WebUI service
  200. ```bash
  201. $ cd web
  202. $ npm install --registry=https://registry.npmmirror.com --force
  203. $ umi build
  204. $ mkdir -p /ragflow/web
  205. $ cp -r dist /ragflow/web
  206. $ apt install nginx -y
  207. $ cp ../docker/nginx/proxy.conf /etc/nginx
  208. $ cp ../docker/nginx/nginx.conf /etc/nginx
  209. $ cp ../docker/nginx/ragflow.conf /etc/nginx/conf.d
  210. $ systemctl start nginx
  211. ```
  212. ## 📚 Documentation
  213. - [Quickstart](./docs/quickstart.md)
  214. - [FAQ](./docs/faq.md)
  215. ## 📜 Roadmap
  216. See the [RAGFlow Roadmap 2024](https://github.com/infiniflow/ragflow/issues/162)
  217. ## 🏄 Community
  218. - [Discord](https://discord.gg/4XxujFgUN7)
  219. - [Twitter](https://twitter.com/infiniflowai)
  220. ## 🙌 Contributing
  221. 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](https://github.com/infiniflow/ragflow/blob/main/docs/CONTRIBUTING.md) first.