rag-assistant — AI Agent
Project description
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
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rag_assistant_ldxs-0.10.0-py3-none-any.whl.
File metadata
- Download URL: rag_assistant_ldxs-0.10.0-py3-none-any.whl
- Upload date:
- Size: 148.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd7cedf7ec647386823b1b89606584992ae956b90caa03d58e61d8b17770c3b5
|
|
| MD5 |
c2271dd10beabc8320d588e5766b6ab7
|
|
| BLAKE2b-256 |
71e9ee2c4bd51a6c0271534b783a7b71e948037ea384f8223c56e481359ee71e
|
Provenance
The following attestation bundles were made for rag_assistant_ldxs-0.10.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on Ldxs001/workbuddy-skills
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rag_assistant_ldxs-0.10.0-py3-none-any.whl -
Subject digest:
bd7cedf7ec647386823b1b89606584992ae956b90caa03d58e61d8b17770c3b5 - Sigstore transparency entry: 2160048497
- Sigstore integration time:
-
Permalink:
Ldxs001/workbuddy-skills@5b90477a389ca5501f5183210cc6bd5330dffc39 -
Branch / Tag:
refs/tags/v0.10.0 - Owner: https://github.com/Ldxs001
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5b90477a389ca5501f5183210cc6bd5330dffc39 -
Trigger Event:
push
-
Statement type: