Skip to main content

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

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.0.0-py3-none-any.whl (151.2 kB view details)

Uploaded Python 3

File details

Details for the file rag_assistant_ldxs-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rag_assistant_ldxs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29b96112a6653d7b280228bf4f41dc46b7a00ce9ca845f8d44b777b22b51f0fb
MD5 89840c91fcc7cbb50d6e327852fc4ac1
BLAKE2b-256 331b0604b72fe8f8fa976763e8bcd4c501a2ee94294021aa26e136fa217e31da

See more details on using hashes here.

Provenance

The following attestation bundles were made for rag_assistant_ldxs-1.0.0-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

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

This release

1.0.0 This release

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