kenny67nju a4aa88f697 chore: prep monorepo for first GitHub release před 3 měsíci
..
scripts a4aa88f697 chore: prep monorepo for first GitHub release před 3 měsíci
ARCHITECTURE.md abd653428d feat: add WebUI, setup wizard, workspace routing fix, and agent examples před 3 měsíci
LAMBDA_RAG_PLAN.md abd653428d feat: add WebUI, setup wizard, workspace routing fix, and agent examples před 3 měsíci
RAG_FUSION_PLAN.md abd653428d feat: add WebUI, setup wizard, workspace routing fix, and agent examples před 3 měsíci
RAG_V2_PLAN.md a4aa88f697 chore: prep monorepo for first GitHub release před 3 měsíci
README.md abd653428d feat: add WebUI, setup wizard, workspace routing fix, and agent examples před 3 měsíci
TEST_RESULTS.md abd653428d feat: add WebUI, setup wizard, workspace routing fix, and agent examples před 3 měsíci
TODO.md abd653428d feat: add WebUI, setup wizard, workspace routing fix, and agent examples před 3 měsíci
agent-config.yml abd653428d feat: add WebUI, setup wizard, workspace routing fix, and agent examples před 3 měsíci

README.md

qaagent67lambda — LambdaRAG 通用领域问答智能体

架构

Query → Classify → 4路并行检索 → 加权RRF融合 → LLM生成
         │
         ├── BM25 (关键词精确匹配)
         ├── Vector (bge-m3 语义检索)
         ├── Graph (实体关系图谱扩展)
         └── Wiki (LLM编译知识)

目录结构

代码和数据完全分离:

agentexample/qaagent67lambda/     ← 智能体代码 (版本控制)
├── agent-config.yml               # 配置 (路径指向 knowledge/{domain})
├── README.md
├── scripts/                       # LambdaRAG 核心脚本
│   ├── config.py                  # 统一配置加载 (所有脚本从这里读路径)
│   ├── search_unified.py          # 统一检索引擎 (True Fusion)
│   ├── search_engine.py           # BM25 检索
│   ├── search_engine_v2.py        # 混合检索 (BM25+Vector)
│   ├── graph_engine.py            # 实体关系图谱
│   ├── extract_pdfs_v2.py         # PDF提取 (表格感知)
│   ├── rebuild_index.py           # BM25索引构建
│   ├── build_vector_index.py      # 向量索引构建
│   ├── wiki_compile.py            # Wiki编译 (时间规范化+关系提取)
│   ├── test_unified.py            # 测试脚本
│   └── app.py                     # Web demo
└── workspace/                     # 运行时数据 (每次 run 的中间过程)
    └── run_YYYYMMDD_HHMMSS/
        ├── input.json
        ├── output.json
        └── trace.json

/home/67/knowledge/{domain}/      ← 领域数据 (持久化, 不版本控制)
├── raw/                           # 原始文件 (PDF/PPTX/DOCX/MD)
├── processed/                     # 提取后的文本
├── wiki/                          # Wiki 编译知识
│   ├── sources/, entities/, topics/, analyses/
│   ├── relations.json
│   └── index.md
├── rag_index.pkl                  # BM25 索引
├── rag_vectors_v2.npy             # 向量索引
├── metadata.json                  # 文件元数据
└── feedback/                      # 自增强数据

快速开始

1. 添加知识库文件

将 PDF/txt/md 文件放入 knowledge/raw/ 目录。

2. 构建索引 (在服务器上)

# Step 1: PDF提取
python scripts/extract_pdfs_v2.py

# Step 2: BM25索引
python scripts/rebuild_index.py

# Step 3: 向量索引 (需要 bge-m3 embedding 服务)
python scripts/build_vector_index.py

# Step 4: Wiki编译 (需要 LLM 服务)
python scripts/wiki_compile.py

3. 启动 Web Demo

python scripts/app.py
# 访问 http://localhost:8080

权重配置 (agent-config.yml)

分类器根据问题类型自动调整 4 路检索的权重:

类型 BM25 Vector Graph Wiki
fact 1.0 0.5 0.1 0.1
compare 0.5 0.8 0.4 0.7
relation 0.5 0.3 0.7 0.8
synthesis 0.6 0.5 0.5 0.6
temporal 1.0 0.2 0.05 0.2

性能 (海事领域 180 题测试)

Overall: Unified 89.8% > BM25 89.1%
Wins: Unified 8 : BM25 6 (166 tie)