Welcome to ROSMASTER A1 PRO repository
6.Deploy the RAG Knowledge Base
Deploy the RAG Knowledge Base
Deploy the RAG Knowledge Base1. Course Content2. Starting the Dify Service3. Viewing the Preset Knowledge Base4. Extending the RAG Knowledge Base4.1 Economy-Mode Knowledge Base4.2 High-Quality-Mode Knowledge Base4.3 Retrieval Testing
1. Course Content
Master the process and methods for locally deploying, debugging, and testing the RAG knowledge base.
Master the methods for extending the RAG knowledge base according to your own task scenarios.
Tip
The RAG knowledge base helps general-purpose AI large models provide reference knowledge in vertical domains, avoiding hallucinated responses and improving the model's ability to answer within a vertical domain.
The RAG knowledge base helps robots quickly extend their generalization ability across different task scenarios.
2. Starting the Dify Service
Connect to the onboard computer via VNC or SSH, and enter the following command in the terminal:
sh ~/bringup_dify.sh

Open a terminal to view the current IP address.

3. Viewing the Preset Knowledge Base
Click the Knowledge Base page on the home page. Dify comes with two preset RAG knowledge bases by default, which contain the same content and differ only in language.
Tip
The preset knowledge bases here provide training samples for some task scenarios, helping the AI model quickly master the relevant skills.

Open a knowledge base. There are two preset files in it:
Intent_enandLibray_NUWA_EN, where:Intent_en: used to store user intents and the corresponding tasks that the robot needs to perform.
Libray_NUWA_EN: stores some preset reference samples for task scenarios.

4. Extending the RAG Knowledge Base
If you need to extend the knowledge base, click Create Knowledge.

Here, importing local data is used as the example data source.
Click Import from Text → Select File → Next.

Then you enter the knowledge base configuration page. Click the Preview block to view the chunking effect on the file. Here, the indexing mode is set to Economy.
Tip
For beginners, we recommend using the Economy mode first for learning and testing. The difference between the two indexing modes:
Economy: retrieves content in the knowledge base through keywords; it cannot perform extended retrieval based on similar semantics, so the way of retrieving knowledge segments is relatively rigid.
High Quality mode: requires an embedding model that consumes extra tokens and also requires a rerank model, achieving more accurate retrieval of semantically similar segments.
4.1 Economy-Mode Knowledge Base
Select the following configuration, then click Save and Process.

Then wait for the embedding to complete and click Go to document.

When the knowledge base is normal, its status will be displayed as Available. Then click the Documents of the knowledge base.

Then we can see the knowledge base chunks that have been segmented. The small text below each chunk is the automatically segmented keyword of that chunk (available only in the Economy mode).

If the keyword does not accurately describe the knowledge segment, click Edit on the right side of the segment to edit the content or keyword of that segment individually. In the figure below, the keyword was modified, and then Save was clicked.

4.2 High-Quality-Mode Knowledge Base
If you need to use a high-quality knowledge base later, refer to the tutorial in this section.
Creating the knowledge base and importing the file are the same as before.
Here, select High Quality as the indexing mode, and choose any retrieval method (hybrid retrieval is used as an example here). Finally, click Save and Process.

4.3 Retrieval Testing
Retrieval Testing tests the actual effect of recalling relevant knowledge segments from the knowledge base based on input, helping to tune better AI model reply effects.
Open a knowledge base and click Retrieval Testing on the left side.

Enter test content in the Source Text field (simulating the content that a user inputs in actual use), and then click Test.
On the right side, the recalled paragraphs related to the input content will appear. The knowledge base tested here is an Economy-mode knowledge base, which retrieves the knowledge base based on keywords.
Tip
The default reference knowledge base shipped from the factory uses the High Quality mode.
For a High Quality mode knowledge base, the recalled segments will have a
SCORErating. The higher the score, the higher the match between the segment and the input content. High Quality mode knowledge bases can perform associative retrieval of similar semantics, but they also consume tokens.
