Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

RAG Assistant

本地知识库问答智能体 — LLM 驱动的组合式语义检索与多库路由。 作者:wUwproject | 许可证:Apache 2.0

基于 local-rag-builder 技能构建的独立 RAG 智能体,支持 LM Studio / Ollama 双后端。


核心特性

特性 说明
组合式查询 LLM 自动对问题做实体/属性分词(entities + attrs),穷举组合后独立检索,SM3 去重合并,LLM 综合回答
多库路由 硬编码关键词 + 语义回退(FallbackRouter)双路由,自动匹配最相关的知识库
自修正决策 LLM 输出格式错误时自动反馈重试(最多 5 次),重试耗尽时清上下文重来
配置持久化 timeout / max_tokens / backend / model 全部保存到 config.json,刷新页面不丢
联网搜索 可选启用,扩展知识库覆盖范围

文件结构

agent/rag-assistant/
├── main.py                           # 入口,CLI + Web 双模式
├── rag_assistant/
│   ├── agent.py                      # Agent 决策循环
│   ├── web_ui.py                     # Web 界面(port 8765)
│   ├── llm_client.py                 # LLM 统一客户端
│   ├── rag_wrapper.py                # 技能封装层
│   ├── search.py                     # 联网搜索
│   └── memory.py                     # 记忆管理
├── scripts/                          # 技能核心模块
├── vendor/                           # 内嵌第三方库
└── data/                             # 运行时数据
    ├── config/rag_config.json        # LLM 与检索配置
    ├── models/                       # 嵌入/路由/rerank 模型
    ├── kb/                           # 知识库(Chroma 向量库)
    └── ...

快速开始

# 1. 安装依赖
pip install -r requirements.txt

# 2. 启动(需要 LM Studio 或 Ollama 运行中)
python main.py

# 3. 打开浏览器访问 http://localhost:8765

架构概览

用户输入
  → [LLM 决策层]
       ├─ 闲聊 → 直接回答
       └─ 知识库查询 → entities/attrs 分词
           → [组合展开器] 穷举 entities × attrs
           → [多切片检索] 每片独立走完整 RAG 流程
              1. 路由(嵌入模型 × KB签名/关键词)
              2. 检索(Chroma 相似度)
              3. (可选) 重排序(reranker)
              4. (可选) NLI 三向分类(entailment/neutral/contradiction)
           → [SM3 去重合并](保留 NLI 标签)
           → [LLM 综合回答](带 NLI 标签辅助判断)

依赖

  • LM Studio 或 Ollama(本地 LLM 推理服务)
  • Python 3.9+
  • 嵌入模型(推荐 BAAI/bge-small-zh-v1.5)
  • ChromaDB(向量存储,自动安装)

协议

Apache 2.0


更新说明

[1.3.0b2] - 2026-07-16

修复

  • PyPI 包缺少 vendor/ 目录:构建白名单遗漏 vendor,导致 beautifulsoup4、markdownify、pypdf 等内嵌依赖缺失。修复 pypi-build.py whitelist 并补充到仓库
  • PyPI long_description 缺少更新说明pypi-build.py setup.py 模板未追加 CHANGELOG。改为在 build_agent() 中直接读取 CHANGELOG.md 拼入 LONG_DESC
  • PyPI workflow 正则不识别 PEP 440 版本号:tag v1.3.0b1 因正则 (-[a-zA-Z0-9.]+)?$ 要求 - 前缀被拒。修复为 ([.-]?[a-zA-Z][a-zA-Z0-9]*)?$
  • PyPI build setup.py 语法错误if/elif 被错误嵌入 setup() 调用内部。提取 _detect_status() 独立函数,模板只输出常量
  • PEP 440 版本命名合规化1.3.0-beta1.3.0b1,classifier 自动为 "4 - Beta"

变更

  • PyPI 发布 workflow 增加 if: type == 'agent' 条件,非 agent 项目不触发发布

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rag_assistant_ldxs-1.3.0b2-py3-none-any.whl (168.6 kB view details)

Uploaded Python 3

File details

Details for the file rag_assistant_ldxs-1.3.0b2-py3-none-any.whl.

File metadata

File hashes

Hashes for rag_assistant_ldxs-1.3.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 4f631f55cbbe75907ff83fb2dc6adc19a9f553bf86756ee2c93f9574ac8b061c
MD5 02e4bb88c73903942f38b6ead02b0c05
BLAKE2b-256 00b363de56081a66e4d3667a0aca13740094c80c51ff8289a42afa053cb66d41

See more details on using hashes here.

Provenance

The following attestation bundles were made for rag_assistant_ldxs-1.3.0b2-py3-none-any.whl:

Publisher: publish-pypi.yml on Ldxs001/workbuddy-skills

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.4.1

1 file

2.3.0

1 file

2.2.14

1 file

2.2.12

1 file

2.2.11

1 file

2.2.10

1 file

2.2.8

1 file

1.7.0

1 file

This release

1.3.0b2 This release

1 file

1.2.0

1 file

1.1.2

1 file

1.1.1

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

0.10.0

1 file

0.9.6

1 file

0.9.5

1 file

0.9.4

1 file

0.9.3

1 file

0.9.0

1 file

0.8.6

1 file

0.8.5

1 file

0.8.4

1 file

0.8.3

1 file

0.8.1

1 file

0.8.0

1 file

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.5.3

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page