gitmyhub

Agentic-RAG-Knowledge-Assistant

Python ★ 15 updated 2d ago

本项目是一个基于 Agentic RAG 架构的智能知识问答系统。后端基于 FastAPI 构建,前端使用 React + Vite,集成 Qdrant 向量数据库、BM25 关键词检索、MySQL 结构化查询、Neo4j +知识图谱和 Serper 网络搜索五大知识源。系统核心为一条 7 阶段流水线:查询优化、意图识别、任务拆解、ReAct 代理检索、相关性检查、答案生成及 Self-RAG 质量评估,通过闭环纠错机制保障回答质量。 +支持多用户注册登录,每位用户拥有独立的个人知识库,可上传 PDF、Word、Excel 等多种格式文件并自动向量化,文档入库时自动抽取实体构建知识图谱。系统还实现了三级压缩对话记忆、用户画用户画像自动提取

A multi-user question-answering assistant that searches your uploaded documents and the web across four sources simultaneously, then checks its own answers for accuracy before returning them.

PythonFastAPIReactQdrantMySQLDockersetup: hardcomplexity 4/5

This repository contains a question-answering system built around a technique called Retrieval-Augmented Generation, or RAG. The basic idea behind RAG is that instead of relying purely on an AI model's internal knowledge, you also pull in relevant information from external sources at the time of each question, then combine that information with the AI's reasoning to generate a more accurate answer. This project takes that idea several steps further by adding a multi-stage pipeline with quality checks and automatic retry loops.

When a user asks a question, the system runs it through seven stages. It first rewrites and expands the question to make it more searchable, then decides whether the question even needs external information or can be answered directly. Complex questions are broken into smaller sub-questions. The system then searches four different sources simultaneously: a vector database (which finds content based on meaning rather than exact words), a keyword search index, a relational database for structured data, and a live web search. Results are checked for relevance, and if they do not match well enough, the system retries with a refined query. The answer is generated from whatever was retrieved, and then a final quality check looks for hallucinations, logical errors, and missing information. If the answer fails that check, the whole process starts over from query rewriting.

The system supports multiple users, each with their own private knowledge base. A user can upload PDF, Word, Excel, PowerPoint, or text files, and the system automatically converts them into a searchable format. Conversation history is kept across sessions with a three-tier compression approach: recent messages are stored fully, older ones are progressively summarized to save space.

The project is written in Python with FastAPI on the back end and React on the front end. The README is written in Chinese. Setup requires a running Qdrant vector database (available via Docker), an API key for a compatible AI model such as DeepSeek or Qwen, and optionally a MySQL database and a Serper web search API key. The README includes detailed setup instructions and a breakdown of every source file.

Where it fits