# enterprise-RAG **Repository Path**: beck_john/enterprise-rag ## Basic Information - **Project Name**: enterprise-RAG - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-01 - **Last Updated**: 2026-04-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 企业 RAG 知识问答系统 基于检索增强生成(Retrieval-Augmented Generation)的企业知识库问答平台。 ## 核心特性 - **多平台 LLM**:OpenAI、通义千问、智谱GLM、DeepSeek - **混合检索**:BM25 关键词 + 向量相似度(40/60 权重) - **BGE-Reranker**:检索结果重排序,显著提升 Top-K 质量 - **Agentic RAG**:多步推理、查询重写、自我反思 - **多模态处理**:图片理解、PDF 图片/表格提取 - **企业系统接入**:钉钉、飞书、企业微信 Webhook - **全链路监控**:结构化日志、P95/P99 延迟、请求限流 详细功能说明和架构图见 [操作手册](OPERATION_MANUAL.md)。 ## 快速开始 ### 1. 安装 ```bash pip install -r requirements.txt cp .env.example .env ``` ### 2. 配置 编辑 `.env`,至少配置平台和 API Key: ```env ACTIVE_PLATFORM=qwen DASHSCOPE_API_KEY=your-api-key-here ``` ### 3. 启动 ```bash python app/main.py ``` 访问 http://localhost:8000 使用 Web 界面,http://localhost:8000/docs 查看 API 文档。 ## API 速查 | 端点 | 说明 | |------|------| | `POST /api/v1/query` | 知识问答 | | `POST /api/v1/upload` | 上传文档 | | `GET /api/v1/documents` | 文档列表 | | `POST /api/v1/multimodal` | 多模态查询 | | `POST /api/v1/webhook/{platform}` | 企业系统推送 | | `GET /api/v1/metrics` | 监控指标 | 完整 API 文档:http://localhost:8000/docs ## 使用示例 ```python import requests # 上传文档 requests.post("http://localhost:8000/api/v1/upload", files={"file": open("docs/report.pdf", "rb")}) # 知识问答(启用 Reranker) resp = requests.post("http://localhost:8000/api/v1/query", json={ "question": "公司的核心价值观是什么?", "use_reranker": True }) print(resp.json()["answer"]) # Agentic RAG 多步推理 resp = requests.post("http://localhost:8000/api/v1/query", json={ "question": "对比 A 和 B 的技术差异", "use_agentic": True }) print(resp.json()["reasoning_steps"]) ``` ## 项目结构 ``` enterprise-rag/ ├── app/ # 核心应用 │ ├── main.py # FastAPI 入口 │ ├── rag_engine.py # RAG 引擎 │ ├── reranker.py # BGE-Reranker │ ├── agentic_rag.py # 多步推理 │ ├── multimodal.py # 多模态 │ ├── dataset_manager.py # 数据集管理 │ ├── enterprise_integration.py# 企业接入 │ ├── metrics.py # 监控指标 │ ├── middleware.py # 中间件 │ └── logging_config.py # 日志配置 ├── docs/ # 文档存储 ├── logs/ # 日志输出 ├── eval_datasets/ # 评估数据集 ├── config.py / llm_factory.py # 平台配置 └── .env.example # 配置模板 ``` ## 详细文档 | 文档 | 内容 | |------|------| | [操作手册](OPERATION_MANUAL.md) | 安装部署、配置详解、功能使用、问题排查、最佳实践 | | [API 文档](http://localhost:8000/docs) | 在线 Swagger 接口文档 | ## 许可证 MIT License