Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

quickstart.md 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. ---
  2. sidebar_position: 1
  3. slug: /
  4. ---
  5. # Quick start
  6. RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding. When integrated with LLMs, it is capable of providing truthful question-answering capabilities, backed by well-founded citations from various complex formatted data.
  7. This quick start guide describes a general process from:
  8. - Starting up a local RAGFlow server,
  9. - Creating a knowledge base,
  10. - Intervening with file parsing, to
  11. - Establishing an AI chat based on your datasets.
  12. ## Prerequisites
  13. - CPU >= 4 cores
  14. - RAM >= 16 GB
  15. - Disk >= 50 GB
  16. - Docker >= 24.0.0 & Docker Compose >= v2.26.1
  17. > If you have not installed Docker on your local machine (Windows, Mac, or Linux), see [Install Docker Engine](https://docs.docker.com/engine/install/).
  18. ## Start up the server
  19. This section provides instructions on setting up the RAGFlow server on Linux. If you are on a different operating system, no worries. Most steps are alike.
  20. 1. Ensure `vm.max_map_count` >= 262144:
  21. > To check the value of `vm.max_map_count`:
  22. >
  23. > ```bash
  24. > $ sysctl vm.max_map_count
  25. > ```
  26. >
  27. > Reset `vm.max_map_count` to a value at least 262144 if it is not.
  28. >
  29. > ```bash
  30. > # In this case, we set it to 262144:
  31. > $ sudo sysctl -w vm.max_map_count=262144
  32. > ```
  33. >
  34. > 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:
  35. >
  36. > ```bash
  37. > vm.max_map_count=262144
  38. > ```
  39. > See [this guide](./guides/max_map_count.md) for instructions on permanently setting `vm.max_map_count` on an operating system other than Linux.
  40. 2. Clone the repo:
  41. ```bash
  42. $ git clone https://github.com/infiniflow/ragflow.git
  43. ```
  44. 3. Build the pre-built Docker images and start up the server:
  45. > 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.
  46. ```bash
  47. $ cd ragflow/docker
  48. $ chmod +x ./entrypoint.sh
  49. $ docker compose up -d
  50. ```
  51. > The core image is about 9 GB in size and may take a while to load.
  52. 4. Check the server status after having the server up and running:
  53. ```bash
  54. $ docker logs -f ragflow-server
  55. ```
  56. _The following output confirms a successful launch of the system:_
  57. ```bash
  58. ____ ______ __
  59. / __ \ ____ _ ____ _ / ____// /____ _ __
  60. / /_/ // __ `// __ `// /_ / // __ \| | /| / /
  61. / _, _// /_/ // /_/ // __/ / // /_/ /| |/ |/ /
  62. /_/ |_| \__,_/ \__, //_/ /_/ \____/ |__/|__/
  63. /____/
  64. * Running on all addresses (0.0.0.0)
  65. * Running on http://127.0.0.1:9380
  66. * Running on http://x.x.x.x:9380
  67. INFO:werkzeug:Press CTRL+C to quit
  68. ```
  69. > 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.
  70. 5. In your web browser, enter the IP address of your server and log in to RAGFlow.
  71. > - 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.
  72. ## Configure LLMs
  73. RAGFlow is a RAG engine, and it needs to work with an LLM to offer grounded, hallucination-free question-answering capabilities. For now, RAGFlow supports the following LLMs, and the list is expanding:
  74. - OpenAI
  75. - Tongyi-Qianwen
  76. - ZHIPU-AI
  77. - Moonshot
  78. - DeepSeek-V2
  79. - Baichuan
  80. - VolcEngine
  81. > RAGFlow also supports deploying LLMs locally using Ollama or Xinference, but this part is not covered in this quick start guide.
  82. To add and configure an LLM:
  83. 1. Click on your logo on the top right of the page **>** **Model Providers**:
  84. ![2 add llm](https://github.com/infiniflow/ragflow/assets/93570324/10635088-028b-4b3d-add9-5c5a6e626814)
  85. > Each RAGFlow account is able to use **text-embedding-v2** for free, a embedding model of Tongyi-Qianwen. This is why you can see Tongyi-Qianwen in the **Added models** list. And you may need to update your Tongyi-Qianwen API key at a later point.
  86. 2. Click on the desired LLM and update the API key accordingly (DeepSeek-V2 in this case):
  87. ![update api key](https://github.com/infiniflow/ragflow/assets/93570324/4e5e13ef-a98d-42e6-bcb1-0c6045fc1666)
  88. *Your added models appear as follows:*
  89. ![added available models](https://github.com/infiniflow/ragflow/assets/93570324/d08b80e4-f921-480a-b41d-11832489c916)
  90. 3. Click **System Model Settings** to select the default models:
  91. - Chat model,
  92. - Embedding model,
  93. - Image-to-text model.
  94. ![system model settings](https://github.com/infiniflow/ragflow/assets/93570324/cdcc1da5-4494-44cd-ad5b-1222ed6acc3f)
  95. > Some models, such as the image-to-text model **qwen-vl-max**, are subsidiary to a specific LLM. And you may need to update your API key to access these models.
  96. ## Create your first knowledge base
  97. You are allowed to upload files to a knowledge base in RAGFlow and parse them into datasets. A knowledge base is virtually a collection of datasets. Question answering in RAGFlow can be based on a particular knowledge base or multiple knowledge bases. File formats that RAGFlow supports include documents (PDF, DOC, DOCX, TXT, MD), tables (CSV, XLSX, XLS), pictures (JPEG, JPG, PNG, TIF, GIF), and slides (PPT, PPTX).
  98. To create your first knowledge base:
  99. 1. Click the **Knowledge Base** tab in the top middle of the page **>** **Create knowledge base**.
  100. 2. Input the name of your knowledge base and click **OK** to confirm your changes.
  101. _You are taken to the **Configuration** page of your knowledge base._
  102. ![knowledge base configuration](https://github.com/infiniflow/ragflow/assets/93570324/384c671a-8b9c-468c-b1c9-1401128a9b65)
  103. 3. RAGFlow offers multiple chunk templates that cater to different document layouts and file formats. Select the embedding model and chunk method (template) for your knowledge base.
  104. > IMPORTANT: Once you have selected an embedding model and used it to parse a file, you are no longer allowed to change it. The obvious reason is that we must ensure that all files in a specific knowledge base are parsed using the *same* embedding model (ensure that they are being compared in the same embedding space).
  105. _You are taken to the **Dataset** page of your knowledge base._
  106. 4. Click **+ Add file** **>** **Local files** to start uploading a particular file to the knowledge base.
  107. 5. In the uploaded file entry, click the play button to start file parsing:
  108. ![file parsing](https://github.com/infiniflow/ragflow/assets/93570324/19f273fa-0ab0-435e-bdf4-a47fb080a078)
  109. _When the file parsing completes, its parsing status changes to **SUCCESS**._
  110. ## Intervene with file parsing
  111. RAGFlow features visibility and explainability, allowing you to view the chunking results and intervene where necessary. To do so:
  112. 1. Click on the file that completes file parsing to view the chunking results:
  113. _You are taken to the **Chunk** page:_
  114. ![chunks](https://github.com/infiniflow/ragflow/assets/93570324/0547fd0e-e71b-41f8-8e0e-31649c85fd3d)
  115. 2. Hover over each snapshot for a quick view of each chunk.
  116. 3. Double click the chunked texts to add keywords or make *manual* changes where necessary:
  117. ![update chunk](https://github.com/infiniflow/ragflow/assets/93570324/1d84b408-4e9f-46fd-9413-8c1059bf9c76)
  118. 4. In Retrieval testing, ask a quick question in **Test text** to double check if your configurations work:
  119. _As you can tell from the following, RAGFlow responds with truthful citations._
  120. ![retrieval test](https://github.com/infiniflow/ragflow/assets/93570324/c03f06f6-f41f-4b20-a97e-ae405d3a950c)
  121. ## Set up an AI chat
  122. Conversations in RAGFlow are based on a particular knowledge base or multiple knowledge bases. Once you have created your knowledge base and finished file parsing, you can go ahead and start an AI conversation.
  123. 1. Click the **Chat** tab in the middle top of the mage **>** **Create an assistant** to show the **Chat Configuration** dialogue *of your next dialogue*.
  124. > RAGFlow offer the flexibility of choosing a different chat model for each dialogue, while allowing you to set the default models in **System Model Settings**.
  125. 2. Update **Assistant Setting**:
  126. - Name your assistant and specify your knowledge bases.
  127. - **Empty response**:
  128. - If you wish to *confine* RAGFlow's answers to your knowledge bases, leave a response here. Then when it doesn't retrieve an answer, it *uniformly* responds with what you set here.
  129. - If you wish RAGFlow to *improvise* when it doesn't retrieve an answer from your knowledge bases, leave it blank, which may give rise to hallucinations.
  130. 3. Update **Prompt Engine** or leave it as is for the beginning.
  131. 4. Update **Model Setting**.
  132. 5. RAGFlow also offers conversation APIs. Hover over your dialogue **>** **Chat Bot API** to integrate RAGFlow's chat capabilities into your applications:
  133. ![chatbot api](https://github.com/infiniflow/ragflow/assets/93570324/fec23715-f9af-4ac2-81e5-942c5035c5e6)
  134. 6. Now, let's start the show:
  135. ![question1](https://github.com/infiniflow/ragflow/assets/93570324/bb72dd67-b35e-4b2a-87e9-4e4edbd6e677)
  136. ![question2](https://github.com/infiniflow/ragflow/assets/93570324/7cc585ae-88d0-4aa2-817d-0370b2ad7230)