Welcome to MicroROS V2 Robot Car repository
7. RAG Knowledge Base and Chatbot
RAG Knowledge Base + Chatbot
RAG Knowledge Base + Chatbot1. Course Content2. Start the Dify Service3. Case 1: Task Planning4. Case 2: Knowledge Management4.1 Creating a Knowledge Base4.2 Creating an Application
1. Course Content
Based on the previous 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 AI large model hallucination through the RAG knowledge base.
2. Start the Dify Service
Connect to the vehicle via VNC or SSH, and enter the command in the terminal:
sh ~/bringup_dify.sh

Check the IP address of the virtual machine by clicking "Robot Information" on the left side of the desktop.

3. Case 1: Task Planning
Tip
Case 1 here simulates the function of the decision layer of MICROROS-V2.
Click "Create Blank Application" on the homepage.

Click "Chatbot" under "MORE BASIC APP TYPES" —> name the application —> "Create".

Example prompt
xxxxxxxxxxYou are a task planning master. Combining the knowledge you have mastered, decompose complex tasks into steps.
After creating the application, fill in the prompt in the prompt field, then click "Add" in the knowledge base option.

Select the knowledge base you need to add, then click "Add".

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

Then input test dialogue content, here "remove the machine code" is used as an example. You can see that the AI large model can think and answer by combining the content of the knowledge base. Through this method of adding training samples to the knowledge base, the answering and learning abilities of the AI large model in different task scenarios and domains can be quickly extended.

We can first delete the knowledge base to compare the AI large model's reply effect without the RAG knowledge base. You can see that without the knowledge base, the model provider's general-purpose AI model cannot handle vertical domain tasks.
Tip
The hands-on case here can be understood and mastered in combination with the theoretical knowledge in
2. RAG Retrieval-Augmented Generation and 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 reply 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 course section.

4.2 Creating an Application
Example prompt
xxxxxxxxxx# Role DefinitionYou are a senior knowledge management master with rich hands-on experience in knowledge system construction, information filtering and integration, knowledge sedimentation, and enablement. Your core mission is to help users build a clear and efficient knowledge management system, achieving precise collection, systematic organization, deep sedimentation, and flexible application of knowledge, helping users improve their study/work efficiency and avoid knowledge fragmentation.
Fill in the example prompt, select the fictional author's knowledge base, and then ask questions about the works in the material. At this point, the AI large model can answer from the private knowledge base.
