Skip to content

ssnchenfeng-ai/my_rag_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Industrial GraphRAG Chatbot 🏭🤖

基于知识图谱的化工专家问答系统
Physics-Aware RAG for Chemical Engineering

Tech Data Source License

English | 中文


🇬🇧 English

📖 Introduction

This project is an Industrial RAG (Retrieval-Augmented Generation) application designed to solve the "hallucination" problem of LLMs in engineering domains.

Unlike traditional RAG which only relies on vector search (unstructured text), this system combines Neo4j Knowledge Graphs (structured topology) to understand the physical connections in P&ID drawings (e.g., distinguishing Shell-side vs. Tube-side).

🔗 Data Source

The high-quality graph data used in this project is generated by our companion tool: 👉 Chemical P&ID Graph Editor

🏗️ Architecture

graph LR
    User[User Question] --> UI[Streamlit UI]
    UI --> Logic{Hybrid Search}
    
    subgraph "Knowledge Base"
        KG[(Neo4j Graph)] -- Cypher --> Logic
        Vec[(Vector DB)] -- Similarity --> Logic
    end
    
    Logic --> Context[Context Fusion]
    Context --> LLM[Ollama / DeepSeek]
    LLM --> UI
✨ Features
Hybrid Search: Combines Keyword/Cypher search (Structured) with Vector search (Unstructured).
Physics-Aware: Understands flow direction, medium phases (Vapor/Liquid), and equipment internal structures.
Traceability: Displays the reasoning process and data sources (Graph vs. Documents) in the UI.
🚀 Quick Start
Clone Repository
code
Bash
git clone https://github.com/ssnchenfeng-ai/my_rag_project.git
cd my_rag_project
Install Dependencies
code
Bash
pip install -r requirements.txt
Configuration (Important!)
Create a .streamlit/secrets.toml file in the root directory:
code
Toml
[neo4j]
url = "bolt://localhost:7687"
username = "neo4j"
password = "YOUR_PASSWORD"

[ollama]
base_url = "http://localhost:11434"
model = "llama3"
Run App
code
Bash
streamlit run main.py
<a name="-中文"></a>

🇨🇳 中文

📖 项目简介
这是一个**工业级 RAG(检索增强生成)**应用,旨在解决大语言模型在化工工程领域的“幻觉”问题。

不同于仅依赖向量检索(非结构化文本)的传统 RAG,本系统结合了 Neo4j 知识图谱(结构化拓扑),能够理解 P&ID 图纸中的物理连接关系(如:区分换热器的壳程与管程、物料流向)。

🔗 数据来源生态
本项目的高质量图谱数据由我们的配套编辑器生成:
👉 Chemical P&ID Graph Editor (化工 P&ID 图编辑器)

理念: 编辑器负责“生产”带有物理语义的数据,本系统负责“消费”数据进行智能推理。
🏗️ 系统架构
前端: Streamlit (Python)
逻辑层: LangChain (GraphCypherQAChain + VectorStore)
数据层: Neo4j (图数据) + Chroma/Faiss (向量数据)
大模型: Ollama (Llama3) 或 OpenAI/DeepSeek
✨ 核心功能
混合检索 (Hybrid Search): 同时利用 Cypher 查询(查关系)和 向量检索(查文档),互补短板。
物理感知: 能回答“V-101 下游连接了什么设备?”或“E-102 的液相出口在哪里?”等强逻辑问题。
思维链展示: 在界面上通过折叠框展示 AI 是如何查询图数据库的,增强可解释性。
🚀 快速开始
克隆项目
code
Bash
git clone https://github.com/ssnchenfeng-ai/my_rag_project.git
cd my_rag_project
安装依赖
code
Bash
pip install -r requirements.txt
配置密钥 (重要)
在项目根目录创建文件夹 .streamlit,并在其中新建文件 secrets.toml:
code
Toml
[neo4j]
url = "bolt://localhost:7687"
username = "neo4j"
password = "你的数据库密码"

[ollama]
base_url = "http://localhost:11434"
model = "llama3" # 或其他你部署的模型
启动应用
code
Bash
streamlit run main.py
🤝 贡献与反馈
本项目由化工行业专家 + Google Gemini 3 结对开发。
欢迎提交 Issue 或 Pull Request!

📄 License
MIT License
Loading

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages