writinwaters jinhai-2012 commited on
Commit
799f66f
·
1 Parent(s): 594c8a6

Added descriptions of the retrieval agent component (#4416)

Browse files

### What problem does this PR solve?



### Type of change


- [x] Documentation Update

---------

Co-authored-by: Jin Hai <[email protected]>

docs/guides/agent/text2sql_agent.md CHANGED
@@ -32,9 +32,9 @@ However, traditional Text2SQL solutions often require model fine-tuning, which c
32
  A list of components required:
33
 
34
  - [Begin](https://ragflow.io/docs/dev/begin_component)
35
- - Interface
36
  - Retrieval
37
- - Generate
38
  - ExeSQL
39
 
40
  ## Procedure
 
32
  A list of components required:
33
 
34
  - [Begin](https://ragflow.io/docs/dev/begin_component)
35
+ - [Interact](https://ragflow.io/docs/dev/interact_component)
36
  - Retrieval
37
+ - [Generate](https://ragflow.io/docs/dev/generate_component)
38
  - ExeSQL
39
 
40
  ## Procedure
docs/guides/start_chat.md CHANGED
@@ -57,11 +57,13 @@ You start an AI conversation by creating an assistant.
57
 
58
  :::tip NOTE
59
 
60
- Click the light bubble icon above the answer to view the expanded system prompt:
61
 
62
  ![](https://github.com/user-attachments/assets/515ab187-94e8-412a-82f2-aba52cd79e09)
63
 
64
- Scroll down the expanded prompt to view the time consumed for each task:
 
 
65
 
66
  ![enlighten](https://github.com/user-attachments/assets/fedfa2ee-21a7-451b-be66-20125619923c)
67
  :::
 
57
 
58
  :::tip NOTE
59
 
60
+ 1. Click the light bubble icon above the answer to view the expanded system prompt:
61
 
62
  ![](https://github.com/user-attachments/assets/515ab187-94e8-412a-82f2-aba52cd79e09)
63
 
64
+ *The light bubble icon is available only for the current dialogue.*
65
+
66
+ 2. Scroll down the expanded prompt to view the time consumed for each task:
67
 
68
  ![enlighten](https://github.com/user-attachments/assets/fedfa2ee-21a7-451b-be66-20125619923c)
69
  :::
docs/references/agent_component_reference/generate.mdx CHANGED
@@ -47,7 +47,7 @@ Click the dropdown menu of **Model** to show the model configuration window.
47
  - If disabled, you lift the maximum token limit, allowing the model to determine the number of tokens in its responses.
48
 
49
  :::tip NOTE
50
- If you are uncertain about the mechanism behind **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**, you can simply choose one of the three options of **Freedom**, which defaults to **Precise**.
51
  :::
52
 
53
  ### System prompt
 
47
  - If disabled, you lift the maximum token limit, allowing the model to determine the number of tokens in its responses.
48
 
49
  :::tip NOTE
50
+ If you are uncertain about the mechanism behind **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**, you can simply choose one of the three options of **Freedom**.
51
  :::
52
 
53
  ### System prompt
docs/references/agent_component_reference/interact.mdx CHANGED
@@ -18,4 +18,4 @@ A **Interact** component is essential where you need to display the agent's resp
18
 
19
  ## Examples
20
 
21
- You can explore our three-step interpreter agent template, where the **Interact** component is used to display the final translation, or our customer service agent template, where the **Interact** component is used to display multi-turn dialogue between the user and the agent.
 
18
 
19
  ## Examples
20
 
21
+ You can explore our three-step interpreter agent template, where the **Interact** component is used to display the final translation, or our customer service agent template, where the **Interact** component is the immediate downstream of **Begin** and is used to display multi-turn dialogue between the user and the agent.
docs/references/agent_component_reference/retrieval.mdx ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ sidebar_position: 3
3
+ slug: /retrieval_component
4
+ ---
5
+
6
+ # Retrieval component
7
+
8
+ A component that retrieves information from specified datasets.
9
+
10
+ ## Scenarios
11
+
12
+ 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.
13
+
14
+ ## Configurations
15
+
16
+ Click on a **Retrieval** component to open its configuration window.
17
+
18
+ ### Input
19
+
20
+ 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**.
21
+
22
+ - **Reference**: Uses a component's output or a user input as the data source. You are required to select from the dropdown menu:
23
+ - A component ID under **Component Output**, or
24
+ - A global variable under **Begin input**, which is defined in the **Begin** component.
25
+ - **Text**: Uses fixed text as the query. You are required to enter static text.
26
+
27
+ ### Similarity threshold
28
+
29
+ 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.
30
+
31
+ Defaults to 0.2.
32
+
33
+ ### Keywords similarity weight
34
+
35
+ 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.
36
+
37
+ ### Top N
38
+
39
+ This parameter selects the "Top N" chunks from retrieved ones and feed them to the LLM.
40
+
41
+ Defaults to 8.
42
+
43
+
44
+ ### Rerank model
45
+
46
+ *Optional*
47
+
48
+ If a rerank model is selected, a combination of weighted keyword similarity and weighted reranking score will be used for retrieval.
49
+
50
+ :::caution WARNING
51
+ Using a rerank model will *significantly* increase the system's response time.
52
+ :::
53
+
54
+
55
+ ### Knowledge bases
56
+
57
+ *Required*
58
+
59
+ You are required to select the knowledge base(s) to retrieve data from.
60
+
61
+ :::danger IMPORTANT
62
+ If you select multiple knowledge bases must ensure that the knowledge bases (datasets) you select use the same embedding model; otherwise, an error message would occur.
63
+ :::
64
+
65
+
66
+
67
+ ## Examples
68
+
69
+ 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:
70
+
71
+ 1. Click the **Agent** tab at the top center of the page to access the **Agent** page.
72
+ 2. Click **+ Create agent** on the top right of the page to open the **agent template** page.
73
+ 3. On the **agent template** page, hover over the **Interperter** card and click **Use this template**.
74
+ 4. Name your new agent and click **OK** to enter the workflow editor.
75
+ 5. Click on the **Retrieval** component to display its **Configuration** window.
web/src/locales/en.ts CHANGED
@@ -156,7 +156,7 @@ export default {
156
  cancel: 'Cancel',
157
  rerankModel: 'Rerank model',
158
  rerankPlaceholder: 'Please select',
159
- rerankTip: `If left empty, RAGFlow will use a combination of weighted keyword similarity and weighted vector cosine similarity; if a rerank model is selected, a weighted reranking score will replace the weighted vector cosine similarity.`,
160
  topK: 'Top-K',
161
  topKTip: `K chunks will be fed into rerank models.`,
162
  delimiter: `Delimiter`,
@@ -410,7 +410,7 @@ This procedure will improve precision of retrieval by adding more information to
410
  improvise: 'Improvise',
411
  precise: 'Precise',
412
  balance: 'Balance',
413
- freedomTip: `Set the freedom level to 'Precise' to strictly confine the LLM's response to your selected knowledge base(s). Choose 'Improvise' to grant the LLM greater freedom in its responses, which may lead to hallucinations. 'Balance' is an intermediate level; choose 'Balance' for more balanced responses.`,
414
  temperature: 'Temperature',
415
  temperatureMessage: 'Temperature is required',
416
  temperatureTip: `This parameter controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses.`,
@@ -723,7 +723,7 @@ This procedure will improve precision of retrieval by adding more information to
723
  title: 'ID:',
724
  beginDescription: 'This is where the flow begins.',
725
  answerDescription: `A component that serves as the interface between human and bot, receiving user inputs and displaying the agent's responses.`,
726
- retrievalDescription: `A component that retrieves information from a specified knowledge base and returns 'Empty response' if no information is found. Ensure the correct knowledge base is selected.`,
727
  generateDescription: `A component that prompts the LLM to generate responses. Ensure the prompt is set correctly.`,
728
  categorizeDescription: `A component that uses the LLM to classify user inputs into predefined categories. Ensure you specify the name, description, and examples for each category, along with the corresponding next component.`,
729
  relevantDescription: `A component that uses the LLM to assess whether the upstream output is relevant to the user's latest query. Ensure you specify the next component for each judge result.`,
 
156
  cancel: 'Cancel',
157
  rerankModel: 'Rerank model',
158
  rerankPlaceholder: 'Please select',
159
+ rerankTip: `If left empty, RAGFlow will use a combination of weighted keyword similarity and weighted vector cosine similarity; if a rerank model is selected, a weighted reranking score will replace the weighted vector cosine similarity. Please be aware that using a rerank model will significantly increase the system's response time.`,
160
  topK: 'Top-K',
161
  topKTip: `K chunks will be fed into rerank models.`,
162
  delimiter: `Delimiter`,
 
410
  improvise: 'Improvise',
411
  precise: 'Precise',
412
  balance: 'Balance',
413
+ freedomTip: `A shortcut to 'Temperature', 'Top P', 'Presence penalty', and 'Frequency penalty' settings, indicating the freedom level of the model. This parameter has three options: Select 'Improvise' to produce more creative responses; select 'Precise' (default) to produce more conservative responses; 'Balance' is a middle ground between 'Improvise' and 'Precise'.`,
414
  temperature: 'Temperature',
415
  temperatureMessage: 'Temperature is required',
416
  temperatureTip: `This parameter controls the randomness of the model's predictions. A lower temperature results in more conservative responses, while a higher temperature yields more creative and diverse responses.`,
 
723
  title: 'ID:',
724
  beginDescription: 'This is where the flow begins.',
725
  answerDescription: `A component that serves as the interface between human and bot, receiving user inputs and displaying the agent's responses.`,
726
+ retrievalDescription: `A component that retrieves information from specified knowledge bases (datasets). Ensure that the knowledge bases you select use the same embedding model.`,
727
  generateDescription: `A component that prompts the LLM to generate responses. Ensure the prompt is set correctly.`,
728
  categorizeDescription: `A component that uses the LLM to classify user inputs into predefined categories. Ensure you specify the name, description, and examples for each category, along with the corresponding next component.`,
729
  relevantDescription: `A component that uses the LLM to assess whether the upstream output is relevant to the user's latest query. Ensure you specify the next component for each judge result.`,