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.

retrieval.mdx 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ---
  2. sidebar_position: 4
  3. slug: /retrieval_component
  4. ---
  5. # Retrieval component
  6. A component that retrieves information from specified datasets.
  7. ## Scenarios
  8. A **Retrieval** component is essential in most RAG scenarios, where information is extracted from designated knowledge bases before being sent to the LLM for content generation.
  9. ## Configurations
  10. Click on a **Retrieval** component to open its configuration window.
  11. ### Input
  12. The **Retrieval** component relies on input variables to specify its data inputs (queries). Click **+ Add variable** in the **Input** section to add the desired input variables. There are two types of input variables: **Reference** and **Text**.
  13. - **Reference**: Uses a component's output or a user input as the data source. You are required to select from the dropdown menu:
  14. - A component ID under **Component Output**, or
  15. - A global variable under **Begin input**, which is defined in the **Begin** component.
  16. - **Text**: Uses fixed text as the query. You are required to enter static text.
  17. ### Similarity threshold
  18. RAGFlow employs a combination of weighted keyword similarity and weighted vector cosine similarity during retrieval. This parameter sets the threshold for similarities between the user query and chunks stored in the datasets. Any chunk with a similarity score below this threshold will be excluded from the results.
  19. Defaults to 0.2.
  20. ### Keyword similarity weight
  21. This parameter sets the weight of keyword similarity in the combined similarity score. The total of the two weights must equal 1.0. Its default value is 0.7, which means the weight of vector similarity in the combined search is 1 - 0.7 = 0.3.
  22. ### Top N
  23. This parameter selects the "Top N" chunks from retrieved ones and feed them to the LLM.
  24. Defaults to 8.
  25. ### Rerank model
  26. *Optional*
  27. If a rerank model is selected, a combination of weighted keyword similarity and weighted reranking score will be used for retrieval.
  28. :::caution WARNING
  29. Using a rerank model will *significantly* increase the system's response time.
  30. :::
  31. ### Knowledge bases
  32. *Required*
  33. You are required to select the knowledge base(s) to retrieve data from.
  34. :::danger IMPORTANT
  35. If you select multiple knowledge bases, you must ensure that the knowledge bases (datasets) you select use the same embedding model; otherwise, an error message would occur.
  36. :::
  37. ## Examples
  38. Explore our customer service agent template, where the **Retrieval** component (component ID: **Search product info**) is used to search the dataset and send the Top N results to the LLM:
  39. 1. Click the **Agent** tab at the top center of the page to access the **Agent** page.
  40. 2. Click **+ Create agent** on the top right of the page to open the **agent template** page.
  41. 3. On the **agent template** page, hover over the **Customer service** card and click **Use this template**.
  42. 4. Name your new agent and click **OK** to enter the workflow editor.
  43. 5. Click on the **Retrieval** component to display its **Configuration** window.