项目 / phoenix-zhou/industrial-general-rag

phoenix-zhou/industrial-general-rag

行业推荐
语言 Python标签 —数据更新 2026-11-25 06:49:28 · 仓库 2026-11-24

一段话介绍

The project integrates the RAG and FAQ dual mechanisms, introduces intent recognition, dynamic adaptive retrieval, and the RAGAS automated evaluation system, achieving a transformation from empirical optimization to data-driven optimizatio…

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
The project integrates the RAG and FAQ dual mechanisms, introduces intent recognition, dynamic adaptive retrieval, and the RAGAS automated evaluation system, achieving a transformation from empirical optimization to data-driven optimization.
691累计星
30Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

知识库问答与智能客服

适配系统:知识库系统、智能客服平台 · 得分 1.3

具备检索增强与文档问答链路,可直接作为业务知识助手或客服坐席辅助。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
可先运行 docker-compose up -d --build,再运行 python rag_qa/core/ingest_data.py。
特点或设计要点
采用 MySQL FAQ 与 Milvus RAG 双引擎检索,高频问题响应低于 100ms,复杂问题自动降级到 RAG 流程。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-07-22 · 语言 Python · 贡献者 —
rag

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,原样摘录,共 11,812 字节。

# 🏭 Industrial-Intelligent-QA: High-Precision Intelligent Q&A System for General Industry

> **Based on a RAG + FAQ dual-engine architecture, integrating BGE-M3 hybrid retrieval and the RAGAS automated evaluation system to solve LLM hallucinations and knowledge latency.**

## 📖 Project Introduction

This project is an intelligent Q&A system specifically designed for the **General Industrial vertical domain**. Addressing the issues of "knowledge latency" and "hallucinations" common in general large models within professional fields, the system innovatively adopts a **FAQ (MySQL) + RAG (Milvus)** dual-retrieval architecture.

By introducing **BGE-M3 hybrid retrieval**, **dynamic intent recognition routing**, and a **RAGAS automated evaluation closed-loop**, the system transitions from experience-based tuning to data-driven optimization. It ensures the rigor and timeliness of answers while utilizing Redis caching and multi-level indexing strategies to achieve millisecond-level responses for high-frequency queries and second-level responses for complex reasoning.

## ✨ Core Highlights

-   **🚀 Dual-Engine Retrieval Architecture**: Combines MySQL FAQ (BM25 exact matching) with Milvus RAG (semantic vector retrieval). High-frequency questions are answered in **<100ms**, while complex questions automatically degrade to the RAG process.
-   **🧠 Adaptive Multi-Strategy Retrieval**: Features advanced strategies like HyDE and Sub-query Decomposition to effectively solve multi-hop reasoning problems.
-   **🎯 High-Precision Hybrid Retrieval**: Implements Dense + Sparse vector hybrid retrieval based on **BGE-M3**, coupled with **BGE-Reranker-Large** re-ranking to filter noise significantly, boosting accuracy to **90%+**.
-   **📊 RAGAS Automated Evaluation**: Constructs a standardized evaluation dataset to automatically calculate four key metrics (Faithfulness, Answer Relevancy, etc.), enabling a visualized closed-loop for algorithm iteration.
-   **🐳 Full-Chain Containerized Deployment**: Uses Docker Compose for one-click orchestration of Milvus, Redis, MySQL, and backend services, supporting rapid private deployment.

## 🛠️ Tech Stack

| Category | Tech Components |
| :--- | :--- |
| **Core Language** | Python 3.10+ |
| **LLM & Framework** | Qwen2.5-7B, LangChain, Transformers |
| **Vector Database** | Milvus (Dense + Sparse Vector) |
| **Relational DB** | MySQL (FAQ Knowledge Base) |
| **Cache & MQ** | Redis (Hotspot Caching / Session Management) |
| **Embedding & Rerank** | BGE-M3, BGE-Reranker-Large |
| **Evaluation System** | RAGAS, Pandas, Matplotlib |
| **Deployment** | Docker, Docker Compose, Gunicorn |

## 🏗️ System Architecture

The system adopts a layered design, primarily consisting of offline data processing and online services:

```mermaid
graph TD
    User[User Query] --> Router{Intent Recognition Router}
    
    subgraph "Online Service Layer"
    Router -- High Freq / Simple --> FAQ_Module[FAQ Module (MySQL + Redis)]
    Router -- Complex / Long-tail --> RAG_Module[RAG Module (Milvus)]
    
    FAQ_Module -- Similarity > 0.85 --> Response[Direct Answer]
    
    RAG_Module --> Retriever[Hybrid Retrieval (Dense+Sparse)]
    Retriever --> Rerank[BGE-Reranker Re-rank]
    Rerank --> Context[Context Augmentation]
    Context --> LLM[Qwen2.5 Generation]
    LLM --> Response
    end
    
    subgraph "Offline Processing Layer"
    Docs[Industrial Docs/PDF] --> Splitter[Document Splitting]
    Splitter --> Embedder[Vectorization]
    Embedder --> Milvus[(Milvus Vector DB)]
    end
```
## Core Module Descriptions
1. Smart Router: Identifies user intent based on a fine-tuned BERT model and dynamically dispatches requests.
2. AQ Module: Uses BM25 algorithm for keyword matching, hitting Redis cache for ultra-fast responses.
3. RAG Retrieval Engine:
- **Hybrid Retrieval**: Utilizes both semantic and keyword vectors to compensate for the shortcomings of single retrieval methods.
- **Re-ranking**: Fine-tunes scores for initial results to ensure high-quality Top-K context.
- **Evaluation System (RAGAS)**: Runs automated tests regularly to monitor and optimize system performance.
## 🚀 Quick Start
1. Environment Preparation
Ensure Docker and Docker Compose are installed.
```
git clone https://github.com/your-username/Industrial-Intelligent-QA.git
cd Industrial-Intelligent-RAG
``` 
2. Start Services
Use the provided script to start all dependencies (Milvus, Redis, MySQL) and backend services:
``` 
chmod +x start_compose.sh
./start_compose.sh
``` 
Or manually using docker-compose:
``` 
docker-compose up -d --build
``` 
3. Initialize Knowledge Base
Place industrial general documents into the rag_qa/data directory and run the ingestion script:
``` 
python rag_qa/core/ingest_data.py
``` 
4. Access Interfaces
Once the service is started, access via:
API Docs: http://localhost:8000/docs
Health Check: http://localhost:8000/health
## 📂 Project Structure
``` 
integrated_qa_system/
├── base/               # Base config & logging
├── mysql_qa/           # FAQ Module (MySQL + Redis + BM25)
│   ├── cache/          # Redis caching logic
│   └── retrieval/      # Similarity calculation
├── rag_qa/             # RAG Core Module
│   ├── core/           # Full RAG flow orchestration
│   ├── project_document_loaders/ # Document loaders
│   ├── models/         # Model definitions (Embedding, Rerank)
│   └── rag_assessment/ # RAGAS evaluation scripts
├── app.py              # Flask/FastAPI entry
├── docker-compose.yml  # Container orchestration
└── requirements.txt    # Dependencies
``` 
## 📦 Models & Resources
1. Model Downloads
The required models can be downloaded from the link below or from their official repositories:
``` 
Baidu Pan Link: https://pan.baidu.com/s/1qUqdoHzKVa8cq2TJ4AVYIg?pwd=h588 Extraction Code: h588
Required Models:
bert_query_classifier
bert-base-chinese
bge-m3
bge-reranker-large
nlp_bert_document-segmentation_chinese-base
``` 
2. Related Blog
For a step-by-step tutorial on building and learning this system, please refer to:
``` 
https://blog.csdn.net/zhoupenghui168/article/details/162518685
``` 
3. 🤝 Contributing
Issues and Pull Requests are welcome! If you have suggestions for optimizing Industrial RAG, feel free to contact us.

=====================================================================================
# 工业通用领域高精度智能问答系统
基于 RAG + FAQ 双引擎架构,融合 BGE-M3 混合检索与 RAGAS 自动化评估体系,解决大模型幻觉与知识滞后痛点。
## 📖 项目简介
本项目是一个专为工业通用垂直领域设计的智能问答系统。针对通用大模型在专业领域存在的“知识滞后”和“幻觉”问题,系统创新性地采用了 FAQ (MySQL) + RAG (Milvus) 的双路召回架构。
通过引入 BGE-M3 混合检索、动态意图识别路由以及 RAGAS 自动化评估闭环,实现了从经验调优到数据驱动优化的转变。系统不仅保证了回答的严谨性与时效性,还通过 Redis 缓存与多级索引策略,实现了毫秒级的高频响应与秒级的复杂推理回复。
## ✨ 核心亮点
- **🚀 双引擎召回架构**:结合 MySQL FAQ(BM25 精确匹配)与 Milvus RAG(语义向量检索),高频问题 <100ms 响应,复杂问题自动降级至 RAG 流程。
- **🧠 自适应多策略检索**:内置 HyDE、子查询分解(Sub-query Decomposition)等高级策略,有效解决多跳推理难题。
- **🎯 高精度混合检索**:基于 BGE-M3 实现 Dense + Sparse 向量混合检索,配合 BGE-Reranker-Large 重排序,大幅过滤噪声,准确率提升至 90%+。
- **📊 RAGAS 自动化评估**:构建标准化评估数据集,自动化计算 Faithfulness, Answer Relevancy 等四大指标,实现算法迭代的可视化闭环。
- **🐳 全链路容器化部署**:基于 Docker Compose 一键编排 Milvus、Redis、MySQL 及后端服务,支持私有化快速落地。
## 🛠️ 技术栈
| 类别 | 技术组件 |
| :--- | :--- |
| 核心语言 | Python 3.10+ |
| 大模型 & 框架 | Qwen2.5-7B, LangChain, Transformers |
| 向量数据库 | Milvus (Dense + Sparse Vector) |
| 关系型数据库 | MySQL (FAQ 知识库) |
| 缓存 & 消息队列 | Redis (热点缓存 / 会话管理) |
| Embedding & Rerank | BGE-M3, BGE-Reranker-Large |
| 评估体系 | RAGAS, Pandas, Matplotlib |
| 部署运维 | Docker, Docker Compose, Gunicorn |

## 🏗️ 系统架构
系统采用分层设计,主要包含离线数据处理与在线服务两大部分:
```
graph TD
    User[用户 Query] --> Router{意图识别路由}
    
    subgraph "在线服务层"
    Router -- 高频/简单问题 --> FAQ_Module[FAQ 模块 (MySQL + Redis)]
    Router -- 复杂/长尾问题 --> RAG_Module[RAG 模块 (Milvus)]
    
    FAQ_Module -- 相似度 > 0.85 --> Response[直接返回答案]
    
    RAG_Module --> Retriever[混合检索 (Dense+Sparse)]
    Retriever --> Rerank[BGE-Reranker 精排]
    Rerank --> Context[上下文增强]
    Context --> LLM[Qwen2.5 生成]
    LLM --> Response
    end
    
    subgraph "离线处理层"
    Docs[工业通用文档/PDF] --> Splitter[文档切分]
    Splitter --> Embedder[向量化]
    Embedder --> Milvus[(Milvus 向量库)]
    end
 ```

## 核心模块说明
- 1. 智能路由 (Smart Router):基于微调后的 BERT 模型识别用户意图,动态分发请求。
- 2. FAQ 模块:利用 BM25 算法进行关键词匹配,命中 Redis 缓存实现极速响应。
- 3. RAG 检索引擎:
- **混合检索**:同时利用语义向量与关键词向量,弥补单一检索短板。
- **重排序**:对初筛结果进行精细打分,确保 Top-K 上下文的高质量。
- **评估体系 (RAGAS)**:定期运行自动化测试,监控并优化系统表现。
## 🚀 快速开始
1. 环境准备
确保已安装 Docker 和 Docker Compose。
```
git clone https://github.com/your-username/Medical-Intelligent-QA.git
cd Medical-Intelligent-QA
```
2. 一键启动服务
使用提供的脚本启动所有依赖组件(Milvus, Redis, MySQL)及后端服务:
```
chmod +x start_compose.sh
./start_compose.sh
```
或者手动使用 docker-compose:
```
docker-compose up -d --build
```
3. 初始化知识库
将工业通用文档放入 rag_qa/data 目录,运行数据入库脚本:
```
python rag_qa/core/ingest_data.py
```
4. 访问接口
服务启动后,可通过以下地址访问:
API 文档: http://localhost:8000/docs
健康检查: http://localhost:8000/health

## 📂 项目结构
```
integrated_qa_system/
├── base/               # 基础配置与日志模块
├── mysql_qa/           # FAQ 模块 (MySQL + Redis + BM25)
│   ├── cache/          # Redis 缓存逻辑
│   └── retrieval/      # 相似度计算
├── rag_qa/             # RAG 核心模块
│   ├── core/           # 完整 RAG 流程编排
│   ├── project_document_loaders/ # 文档加载器
│   ├── models/         # 模型定义 (Embedding, Rerank)
│   └── rag_assessment/ # RAGAS 评估脚本
├── app.py              # Flask/FastAPI 入口
├── docker-compose.yml  # 容器编排文件
└── requirements.txt    # 依赖列表
```
## 项目相关
1. model下载地址
```
通过网盘分享的文件:models
链接: https://pan.baidu.com/s/1qUqdoHzKVa8cq2TJ4AVYIg?pwd=h588 提取码: h588

所需要的模型如下, 也可以自行在官网下载:
bert_query_classifier
bert-base-chinese
bge-m3
bge-reranker-large
nlp_bert_document-segmentation_chinese-base
```
2. 相关博客地址
可以根据博客一步步搭建学习
```
https://blog.csdn.net/zhoupenghui168/article/details/162518685
```
↑