Welcome to ROSMASTER A1 PRO repository
7.RAG Knowledge Base + chatbot
RAG Knowledge Base + Chatbot
RAG Knowledge Base + Chatbot1. Course Content2. Starting the Dify Service3. Case 1: Task Planning4. Case 2: Knowledge Management4.1 Creating a Knowledge Base4.2 Creating an Application
1. Course Content
Building on the earlier RAG knowledge base and chatbot, develop an AI application that combines the two, thereby improving the AI large model's answering ability in specific domains and reducing the hallucination of the AI large model through the RAG knowledge base.
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

Log in to the backend using the IP address.
3. Case 1: Task Planning
Tip
Case 1 here simulates the decision-layer functionality of the A1 Pro car.
Click Create from Template on the home page.

Click to select "Chat Assistant" under Chatbot ->App Name & Icon -> Create.

Example prompt
xxxxxxxxxxYou are a task planning master. Using your knowledge, break down complex tasks into steps.
After creating the application, fill in the default prompt in the INSTRUCTIONS, and then click Add in the Knowledge Base option.

Select the knowledge base you want to add, and then click Add.

Then select an AI large model to connect. Here, the
qwen-maxmodel is used as an example.

After that, enter the test dialogue content. Here, we use removing machine code as an example. You can see that the AI large language model can think and answer based on the content of the knowledge base. By adding training examples to the knowledge base in this way, you can quickly expand the AI large language model's response capabilities and learning abilities in different task scenarios and fields.

We can first delete the knowledge base to compare the AI large model's reply effect without a RAG knowledge base. As you can see, without the knowledge base, the model provider's general-purpose AI model cannot handle tasks in vertical domains.
Tip
This hands-on case can be understood and mastered together with the theoretical knowledge in
2.RAG retrieval enhancement and model training samples.

4. Case 2: Knowledge Management
When we have internal materials that need to be managed by a large model, we can combine the AI large model with RAG and a knowledge base so that the large model can answer based on actual business materials. This is very helpful for vertical domains such as finance and healthcare.
4.1 Creating a Knowledge Base
Here, an example material is used, which contains a fictional literary author and a fictional collection of works. The example material can be found in the folder of this lesson.

4.2 Creating an Application
Example prompt
xxxxxxxxxx# Role PositioningBorn in 1988 in a southern coastal city, he worked as an advertising copywriter for 5 years before resigning in 2015 to write full-time. He excels at blending delicate emotional portrayals with light science fiction elements, exploring the loneliness and connection of modern urban dwellers, and the balance between technological development and human warmth. His works combine a healing quality with thought-provoking themes, targeting primarily urban youth aged 25-40.
Fill in the example prompt, and select the knowledge base of the fictional author. Then ask questions about the works in the material, and the AI large model can answer based on the private knowledge base.
