Welcome to DOFBOT-Ultra repository
6. Deploy the RAG knowledge base
Deploy Local RAG Knowledge Base
Please ensure that the web control program backend process is not running in the background. To close it, refer to the [Get Started Quickly - 2. Access the Terminal] section in [Disable the Auto-Start Web Control Backend Process]. After closing, please restart DofbotUltra!!!
Deploy Local RAG Knowledge Base1. Course Content2. Start Dify Service3. View Preset Knowledge Bases4. Extend RAG Knowledge Base4.1 Economy Mode Knowledge Base4.2 High Quality Mode Knowledge Base4.3 Recall Test
1. Course Content
Master the workflow for local deployment, debugging, and testing of RAG knowledge bases
Master the method for extending RAG knowledge bases according to your specific task scenarios
Tip
RAG knowledge bases help general AI large models provide reference knowledge in vertical domains, avoiding hallucination responses from AI models and increasing the model's response capability in vertical domain knowledge
RAG knowledge bases can help robots quickly expand their generalization capabilities in different task scenarios
2. Start Dify Service
Dify backend runs on the host machine of the DofbotUltra mainboard, not inside a docker container
After connecting to the vehicle via VNC or SSH, execute the following command in any directory on the host to start Dify:
bringup_dify
After startup is complete, you can view the vehicle's IP address through the OLED screen,
ifconfig, or directly in the terminal. Enter this IP in a browser on the same local area network to access the Dify management page.
Tip
If you haven't configured the model provider API Key yet, please complete the
02-Configure API-KEYcourse from earlier in this chapter before continuing with the knowledge base and model configurationIf the browser cannot access it, you can execute
docker pson the host to confirm thatlanggenius/dify-*related containers are in theUpstate

3. View Preset Knowledge Bases
Click on the Knowledge Base page on the homepage. Dify comes pre-configured with 2 RAG knowledge bases from the factory. The content is the same, only the language differs.
Tip
The preset knowledge bases here provide some training examples for task scenarios, helping AI models quickly master relevant skills

Open a knowledge base, which contains the
Decision Layer Example Librarypreset file, where:Decision Layer Example Library: stores some preset reference examples related to specific task scenarios

4. Extend RAG Knowledge Base
If you need to extend a new knowledge base, click Create Knowledge Base

Here we use importing local data as an example for the data source
Click Import Existing Text ———> Select File ———> Next

Then enter the knowledge base configuration page. Click Preview Chunk to view the chunking effect of the file. Here select Economy for the index mode
Tip
For beginners, it is recommended to use Economy mode for learning and testing first. The differences between the two index modes are:
Economy: retrieves content in the knowledge base through keywords, cannot perform extended retrieval of similar semantics, and the method of retrieving knowledge fragments is relatively rigid
High Quality mode: requires an embedding model that consumes additional tokens and needs a rerank model, can achieve more accurate retrieval of similar semantic fragments
The factory default knowledge base mode is High Quality mode
4.1 Economy Mode Knowledge Base
After selecting the following configuration, click Save and Process

Then wait for the embedding to complete, click Go to Documents

When the knowledge base is normal, the status will show as Available, then click on the knowledge base file

Afterwards we can see the knowledge base fragments that have been split. Below each chunk, the small text is the automatically split keywords for that segment (only available in Economy mode)

If the keywords do not accurately describe the knowledge fragment, click Edit on the right side of the fragment to edit the fragment content or keywords individually. The image below shows modifying the keywords, then click Save


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
Knowledge base creation and file import are the same as before
Here select High Quality for the index mode, choose any retrieval method (here we use hybrid retrieval as an example), and finally click Save and Process

4.3 Recall Test
Recall test is used to test the actual effect of recalling relevant knowledge fragments from the knowledge base based on input, helping to optimize better AI model response effects
After opening a knowledge base, click Recall Test on the left side

Enter test content in the source text (simulating user input during actual use), then click Test
Recalled paragraphs will appear on the right side, showing the knowledge base related to the input content. The knowledge base tested here is in Economy mode, which retrieves the knowledge base based on keywords

If it is a High Quality mode knowledge base, the recalled fragments will have a
SCORErating. The higher the score, the higher the relevance between the fragment and the input content. High Quality mode knowledge bases can perform associative retrieval of similar semantics, but also need to consume tokens.
