Building a RAG-Based Intelligent Assistant

This article provides a detailed technical guide on implementing a Retrieval-Augmented Generation (RAG) intelligent assistant using the InternLM framework and the Huixiangdou toolset. The process involves creating a domain-specific knowledge base, deploying the assistant on cloud platforms, and integrating it with popular communication tools like WeChat and Feishu.

Domain-Specific Knowledge Base Creation

A domain-specific knowledge base is the fuondation of the RAG system. The following steps outline the creation process:

  • Knowledge Repository Setup: Create a knowledge repository named AIHardware with password protection in the Huixiangdou web interface.
  • Document Upload: Upload three hardware chip datasheets:
    • LPC1759_58_56_54_52_51.pdf
    • msp430f5132.pdf
    • STM32F103xC_D_E_CD00191185.pdf
  • Query Testing: Test the system with queries such as:
    • Wich chip supports direct memory access technology?
    • What is the operating temperature range of MSP chips?

The system demonstrates the ability to combine document content with large language model (LLM) knowledge to provide accurate answers. Below is a comparison table generated by the system for LPC and STM chips:

Feature LPC STM
Architecture ARM Cortex-M ARM Cortex-M3
CPU Frequency Up to 72 MHz Up to 72 MHz
Memory 512KB Flash, 64KB SRAM 512KB Flash, 64KB SRAM
Interfaces USB, CAN, SPI, I2C, USART USB, CAN, SPI, I2C, USART
Timers 3 advanced timers 4 advanced timers

Cloud Deployment

To deploy the Huixiangdou system on cloud infrastructure:

  1. Development Environment Setup: Create a cloud development instance with 30% A100 resource allocation (24GB GPU memory) in the InternLM Studio environment.

  2. Dependency Installation: Install required Python packages: ``` pip install protobuf==4.25.3 accelerate==0.28.0 aiohttp==3.9.3 ...

  3. Model Configuration: Configure the model paths in config.ini: ``` embedding_model_path = "/root/models/bce-embedding-base_v1" reranker_model_path = "/root/models/bce-reranker-base_v1" local_llm_path = "/root/models/internlm2-chat-7b"

  4. Knowledge Vectorization: Process the knowledge corpus into vector representations: ``` python3 -m huixiangdou.service.feature_store --sample ./test_queries.json

    
    

Integration with Communication Platforms

The assistant can be integrated into popular platforms using the following appproaches:

Web Interface Deployment

Use Gradio to create an interactive web demo:

pip install gradio==4.25.0
python3 -m tests.test_query_gradio

Web Search Integration

Enable online search capabilities by:

  • Registering for a Serper API key

  • Configuring the search settings in config.ini: ``` [web_search] x_api_key = "your_api_key" domain_partial_order = ["openai.com", "pytorch.org", "readthedocs.io", ...]

    
    

Remote LLM Configuration

To use remote language models:

  • Sign up on the DeepSeek platform

  • Create API credentials and update the configuration: ``` [llm] enable_local = 0 enable_remote = 1

    [llm.server] remote_type = "deepseek" remote_api_key = "your_api_key"

    
    

Advanced Integration Scenarios

The assistant can be further integrated into enterprise platforms like Feishu and WeChat:

Feishu Integration

Steps include:

  • Registering a bot application in the Feishu developer console
  • Configuring OAuth settings and callback URLs
  • Setting up message handling permissions

WeChat Integration

Requires:

  • Installing WeChat version 8.0.47
  • Configuring the Huixiangdou Android app for WeChat integration
  • Enabling accessibility features in the WeChat settings

Project Concepts

Potential applications of this RAG system include:

  • AI Hardware Search Portal: A specialized search engine for hardware components and related resources.
  • RAG-Powered Content Monetization: Leveraging RAG to drive traffic to premium content sources.

Tags: RAG LLM InternLM Huixiangdou Gradio

Posted on Fri, 31 Jul 2026 16:52:55 +0000 by dude81