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_zh.md 11KB

1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <div align="center">
  2. <a href="https://demo.ragflow.io/">
  3. <img src="web/src/assets/logo-with-text.png" width="350" 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. ## 💡 RAGFlow 是什么?
  25. [RAGFlow](https://ragflow.io/) 是一款基于深度文档理解构建的开源 RAG(Retrieval-Augmented Generation)引擎。RAGFlow 可以为各种规模的企业及个人提供一套精简的 RAG 工作流程,结合大语言模型(LLM)针对用户各类不同的复杂格式数据提供可靠的问答以及有理有据的引用。
  26. ## 📌 近期更新
  27. - 2024-05-15 集成大模型 OpenAI GPT-4o。
  28. - 2024-05-08 集成大模型 DeepSeek。
  29. - 2024-04-26 增添了'文件管理'功能。
  30. - 2024-04-19 支持对话 API ([更多](./docs/conversation_api.md))。
  31. - 2024-04-16 集成嵌入模型 [BCEmbedding](https://github.com/netease-youdao/BCEmbedding) 和 专为轻型和高速嵌入而设计的 [FastEmbed](https://github.com/qdrant/fastembed)。
  32. - 2024-04-11 支持用 [Xinference](./docs/xinference.md) 本地化部署大模型。
  33. - 2024-04-10 为‘Laws’版面分析增加了底层模型。
  34. - 2024-04-08 支持用 [Ollama](./docs/ollama.md) 本地化部署大模型。
  35. - 2024-04-07 支持中文界面。
  36. ## 🌟 主要功能
  37. ### 🍭 **"Quality in, quality out"**
  38. - 基于[深度文档理解](./deepdoc/README.md),能够从各类复杂格式的非结构化数据中提取真知灼见。
  39. - 真正在无限上下文(token)的场景下快速完成大海捞针测试。
  40. ### 🍱 **基于模板的文本切片**
  41. - 不仅仅是智能,更重要的是可控可解释。
  42. - 多种文本模板可供选择
  43. ### 🌱 **有理有据、最大程度降低幻觉(hallucination)**
  44. - 文本切片过程可视化,支持手动调整。
  45. - 有理有据:答案提供关键引用的快照并支持追根溯源。
  46. ### 🍔 **兼容各类异构数据源**
  47. - 支持丰富的文件类型,包括 Word 文档、PPT、excel 表格、txt 文件、图片、PDF、影印件、复印件、结构化数据, 网页等。
  48. ### 🛀 **全程无忧、自动化的 RAG 工作流**
  49. - 全面优化的 RAG 工作流可以支持从个人应用乃至超大型企业的各类生态系统。
  50. - 大语言模型 LLM 以及向量模型均支持配置。
  51. - 基于多路召回、融合重排序。
  52. - 提供易用的 API,可以轻松集成到各类企业系统。
  53. ## 🔎 系统架构
  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. ## 🎬 快速开始
  58. ### 📝 前提条件
  59. - CPU >= 4 核
  60. - RAM >= 16 GB
  61. - Disk >= 50 GB
  62. - Docker >= 24.0.0 & Docker Compose >= v2.26.1
  63. > 如果你并没有在本机安装 Docker(Windows、Mac,或者 Linux), 可以参考文档 [Install Docker Engine](https://docs.docker.com/engine/install/) 自行安装。
  64. ### 🚀 启动服务器
  65. 1. 确保 `vm.max_map_count` 不小于 262144 【[更多](./docs/max_map_count.md)】:
  66. > 如需确认 `vm.max_map_count` 的大小:
  67. >
  68. > ```bash
  69. > $ sysctl vm.max_map_count
  70. > ```
  71. >
  72. > 如果 `vm.max_map_count` 的值小于 262144,可以进行重置:
  73. >
  74. > ```bash
  75. > # 这里我们设为 262144:
  76. > $ sudo sysctl -w vm.max_map_count=262144
  77. > ```
  78. >
  79. > 你的改动会在下次系统重启时被重置。如果希望做永久改动,还需要在 **/etc/sysctl.conf** 文件里把 `vm.max_map_count` 的值再相应更新一遍:
  80. >
  81. > ```bash
  82. > vm.max_map_count=262144
  83. > ```
  84. 2. 克隆仓库:
  85. ```bash
  86. $ git clone https://github.com/infiniflow/ragflow.git
  87. ```
  88. 3. 进入 **docker** 文件夹,利用提前编译好的 Docker 镜像启动服务器:
  89. ```bash
  90. $ cd ragflow/docker
  91. $ chmod +x ./entrypoint.sh
  92. $ docker compose -f docker-compose-CN.yml up -d
  93. ```
  94. > 请注意,运行上述命令会自动下载 RAGFlow 的开发版本 docker 镜像。如果你想下载并运行特定版本的 docker 镜像,请在 docker/.env 文件中找到 RAGFLOW_VERSION 变量,将其改为对应版本。例如 RAGFLOW_VERSION=v0.5.0,然后运行上述命令。
  95. > 核心镜像文件大约 9 GB,可能需要一定时间拉取。请耐心等待。
  96. 4. 服务器启动成功后再次确认服务器状态:
  97. ```bash
  98. $ docker logs -f ragflow-server
  99. ```
  100. _出现以下界面提示说明服务器启动成功:_
  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. > 如果您跳过这一步系统确认步骤就登录 RAGFlow,你的浏览器有可能会提示 `network anomaly` 或 `网络异常`,因为 RAGFlow 可能并未完全启动成功。
  114. 5. 在你的浏览器中输入你的服务器对应的 IP 地址并登录 RAGFlow。
  115. > 上面这个例子中,您只需输入 http://IP_OF_YOUR_MACHINE 即可:未改动过配置则无需输入端口(默认的 HTTP 服务端口 80)。
  116. 6. 在 [service_conf.yaml](./docker/service_conf.yaml) 文件的 `user_default_llm` 栏配置 LLM factory,并在 `API_KEY` 栏填写和你选择的大模型相对应的 API key。
  117. > 详见 [./docs/llm_api_key_setup.md](./docs/llm_api_key_setup.md)。
  118. _好戏开始,接着奏乐接着舞!_
  119. ## 🔧 系统配置
  120. 系统配置涉及以下三份文件:
  121. - [.env](./docker/.env):存放一些基本的系统环境变量,比如 `SVR_HTTP_PORT`、`MYSQL_PASSWORD`、`MINIO_PASSWORD` 等。
  122. - [service_conf.yaml](./docker/service_conf.yaml):配置各类后台服务。
  123. - [docker-compose-CN.yml](./docker/docker-compose-CN.yml): 系统依赖该文件完成启动。
  124. 请务必确保 [.env](./docker/.env) 文件中的变量设置与 [service_conf.yaml](./docker/service_conf.yaml) 文件中的配置保持一致!
  125. > [./docker/README](./docker/README.md) 文件提供了环境变量设置和服务配置的详细信息。请**一定要**确保 [./docker/README](./docker/README.md) 文件当中列出来的环境变量的值与 [service_conf.yaml](./docker/service_conf.yaml) 文件当中的系统配置保持一致。
  126. 如需更新默认的 HTTP 服务端口(80), 可以在 [docker-compose-CN.yml](./docker/docker-compose-CN.yml) 文件中将配置 `80:80` 改为 `<YOUR_SERVING_PORT>:80`。
  127. > 所有系统配置都需要通过系统重启生效:
  128. >
  129. > ```bash
  130. > $ docker compose -f docker-compose-CN.yml up -d
  131. > ```
  132. ## 🛠️ 源码编译、安装 Docker 镜像
  133. 如需从源码安装 Docker 镜像:
  134. ```bash
  135. $ git clone https://github.com/infiniflow/ragflow.git
  136. $ cd ragflow/
  137. $ docker build -t infiniflow/ragflow:v0.5.0 .
  138. $ cd ragflow/docker
  139. $ chmod +x ./entrypoint.sh
  140. $ docker compose up -d
  141. ```
  142. ## 🛠️ 源码启动服务
  143. 如需从源码启动服务,请参考以下步骤:
  144. 1. 克隆仓库
  145. ```bash
  146. $ git clone https://github.com/infiniflow/ragflow.git
  147. $ cd ragflow/
  148. ```
  149. 2. 创建虚拟环境(确保已安装 Anaconda 或 Miniconda)
  150. ```bash
  151. $ conda create -n ragflow python=3.11.0
  152. $ conda activate ragflow
  153. $ pip install -r requirements.txt
  154. ```
  155. 如果cuda > 12.0,需额外执行以下命令:
  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. 拷贝入口脚本并配置环境变量
  161. ```bash
  162. $ cp docker/entrypoint.sh .
  163. $ vi entrypoint.sh
  164. ```
  165. 使用以下命令获取python路径及ragflow项目路径:
  166. ```bash
  167. $ which python
  168. $ pwd
  169. ```
  170. 将上述`which python`的输出作为`PY`的值,将`pwd`的输出作为`PYTHONPATH`的值。
  171. `LD_LIBRARY_PATH`如果环境已经配置好,可以注释掉。
  172. ```bash
  173. # 此处配置需要按照实际情况调整,两个export为新增配置
  174. PY=${PY}
  175. export PYTHONPATH=${PYTHONPATH}
  176. # 可选:添加Hugging Face镜像
  177. export HF_ENDPOINT=https://hf-mirror.com
  178. ```
  179. 4. 启动基础服务
  180. ```bash
  181. $ cd docker
  182. $ docker compose -f docker-compose-base.yml up -d
  183. ```
  184. 5. 检查配置文件
  185. 确保**docker/.env**中的配置与**conf/service_conf.yaml**中配置一致, **service_conf.yaml**中相关服务的IP地址与端口应该改成本机IP地址及容器映射出来的端口。
  186. 6. 启动服务
  187. ```bash
  188. $ chmod +x ./entrypoint.sh
  189. $ bash ./entrypoint.sh
  190. ```
  191. 7. 启动WebUI服务
  192. ```bash
  193. $ cd web
  194. $ npm install --registry=https://registry.npmmirror.com --force
  195. $ vim .umirc.ts
  196. # 修改proxy.target为127.0.0.1:9380
  197. $ npm run dev
  198. ```
  199. 8. 部署WebUI服务
  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. ## 📚 技术文档
  213. - [Quickstart](./docs/quickstart.md)
  214. - [FAQ](./docs/faq.md)
  215. ## 📜 路线图
  216. 详见 [RAGFlow Roadmap 2024](https://github.com/infiniflow/ragflow/issues/162) 。
  217. ## 🏄 开源社区
  218. - [Discord](https://discord.gg/4XxujFgUN7)
  219. - [Twitter](https://twitter.com/infiniflowai)
  220. ## 🙌 贡献指南
  221. RAGFlow 只有通过开源协作才能蓬勃发展。秉持这一精神,我们欢迎来自社区的各种贡献。如果您有意参与其中,请查阅我们的[贡献者指南](https://github.com/infiniflow/ragflow/blob/main/docs/CONTRIBUTING.md) 。
  222. ## 👥 加入社区
  223. 扫二维码添加 RAGFlow 小助手,进 RAGFlow 交流群。
  224. <p align="center">
  225. <img src="https://github.com/infiniflow/ragflow/assets/7248/bccf284f-46f2-4445-9809-8f1030fb7585" width=50% height=50%>
  226. </p>