AI Skill Hub 推荐使用:document-assistant AI技能包 是一款优质的AI工具。AI 综合评分 7.5 分,在同类工具中表现稳健。如果你正在寻找可靠的AI工具解决方案,这是一个值得深入了解的选择。
document-assistant AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG、文档生成、AI工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
document-assistant AI技能包 是一款基于 Python 开发的开源工具,专注于 RAG、文档生成、AI工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install document-assistant
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install document-assistant
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/gosha70/document-assistant
cd document-assistant
pip install -e .
# 验证安装
python -c "import document_assistant; print('安装成功')"
# 命令行使用
document-assistant --help
# 基本用法
document-assistant input_file -o output_file
# Python 代码中调用
import document_assistant
# 示例
result = document_assistant.process("input")
print(result)
# document-assistant 配置文件示例(config.yml) app: name: "document-assistant" debug: false log_level: "INFO" # 运行时指定配置文件 document-assistant --config config.yml # 或通过环境变量配置 export DOCUMENT_ASSISTANT_API_KEY="your-key" export DOCUMENT_ASSISTANT_OUTPUT_DIR="./output"
A Retrieval-Augmented Generation (RAG) framework with a FastAPI backend, a browser-based chat UI, a full-featured admin console, and a configurable query pipeline. Designed for local-first, private deployments: with a local LLM backend (e.g., Ollama) and a local vector store, all data stays on your machine. When an external LLM backend is configured (llm.backend: openai), queries and retrieved context are sent to that endpoint.
---
---
| Area | Highlights |
|---|---|
| **Ingestion** | 17 file types · PDF, Markdown, HTML, CSV, Excel, JSON, YAML, XML, SQL, Java, JS, Python, RTF, DDL, XSL · Duplicate handling (check / replace / add / skip) |
| **Chunking** | Configurable token-aware splitting · Late Chunking (long-context pooling) · Contextual Augmentation (LLM-generated per-chunk context) |
| **Retrieval** | Hybrid search (dense + BM25 sparse, fused via RRF) · CrossEncoder reranking · Four optional query pipeline stages |
| **Query Pipeline** | Query Decomposition · HyDE (Hypothetical Document Embeddings) · Corrective Retrieval · Answer Verification |
| **LLM Backends** | Ollama (local) · OpenAI-compatible APIs · Legacy GGUF/GPTQ/AWQ quantised models |
| **Vector Stores** | Chroma (dev/local) · Qdrant (production) — swappable via config |
| **API** | FastAPI REST + Server-Sent Events streaming · Interactive Swagger UI (/docs) · ReDoc (/redoc) |
| **Study Mode** | /study/summarize · /study/glossary · /study/flashcards — LLM-generated study aids |
| **Admin Console** | Collection management · Background jobs · Live metrics · Alerts · Periodic reports |
| **Security** | Bearer-token auth (user + admin roles) · Per-IP rate limiting · Prompt injection firewall · Upload validation |
| **Observability** | Request/LLM telemetry · Windowed alerting · Hourly snapshots |
---
poetry install
poetry run pytest tests/e2e/ -v --tb=short ```
poetry install
Copy the default config and set your LLM backend:
cp config/defaults.yaml config/local.yaml
Edit config/local.yaml — minimum for Ollama:
llm:
backend: "ollama" # or "openai"
model: "llama3.2" # any model pulled via `ollama pull`
vectorstore:
persist_directory: "./my_vectorstore"
collection_name: "my_docs"
All other settings have sensible defaults. See Configuration Reference below.
Configuration is YAML-based. The application loads config/defaults.yaml and deep-merges config/local.yaml (if present) on top. Override the config path with DOT_CONFIG_PATH=/path/to/config.yaml.
Full interactive documentation at /docs (Swagger UI) or /redoc.
| Method | Path | Description |
|---|---|---|
GET | /health | Liveness check — {"status": "ok"} |
GET | /status | App info, collection name, document count, embedding model |
POST | /ingest | Upload files (multipart) → ingest into vector store |
POST | /chat | Synchronous Q&A with sources |
POST | /chat/stream | Server-Sent Events streaming Q&A |
| Method | Path | Description |
|---|---|---|
GET | /admin/collections | List all collections |
GET | /admin/collections/{name} | Collection details (count, model, backend) |
GET | /admin/collections/{name}/chunks | Sample chunks (max 50) |
GET | /admin/collections/{name}/sources | List ingested source files |
POST | /admin/collections/{name}/reindex | Trigger background reindex |
POST | /admin/collections/{name}/migrate | Stamp embedding provenance on legacy collections |
GET | /admin/jobs | List background jobs |
GET | /admin/jobs/{id} | Job status and progress |
POST | /admin/jobs/{id}/retry | Retry a failed job |
DELETE | /admin/jobs/{id} | Cancel a running job |
GET | /admin/metrics/runtime | Live process + application metrics |
GET | /admin/alerts | Active alert conditions |
GET | /admin/reports/summary | Snapshot report history |
POST | /admin/reports/generate | Generate an on-demand snapshot |
All stages are independently opt-in:
query_pipeline:
decomposition_enabled: false # Break complex queries into sub-queries
hyde_enabled: false # Hypothetical Document Embeddings
corrective_retrieval_enabled: false # Re-retrieve if confidence < threshold
corrective_retrieval_threshold: 0.4
verification_enabled: false # LLM verifies answer is grounded in sources
max_sub_queries: 5
User Query
│
▼
[Query Decomposition] ← optional: break into ≤5 sub-queries
│
▼
[HyDE] ← optional: generate hypothetical answer, embed it
│
▼
[Hybrid Search] dense (embedding) + sparse (BM25) → RRF fusion
│
▼
[CrossEncoder Rerank] ms-marco-MiniLM-L-6-v2, top-5 of 20 candidates
│
▼
[Corrective Retrieval] ← optional: re-retrieve if confidence < 0.4
│
▼
[Prompt Injection Firewall] sanitize retrieved context
│
▼
[LLM Generation] streamed or synchronous
│
▼
[Answer Verification] ← optional: LLM checks claims against sources
│
▼
Response + Sources + Metadata
---
Use the Chat UI or send a request:
curl -X POST http://127.0.0.1:8000/chat \
-H "Content-Type: application/json" \
-d '{"question": "What does the document say about X?"}'
---
Document Assistant (D.O.T.) 是一个基于 RAG (Retrieval-Augmented Generation) 架构的文档助手框架。它采用 FastAPI 构建后端,提供基于浏览器的 Chat UI 和功能完备的 Admin Console。该项目专为“本地优先”和隐私保护设计,支持通过 Ollama 等工具调用本地 LLM 和本地向量数据库,确保所有数据均保留在您的本地机器中。若配置为 OpenAI 等外部后端,系统也可灵活切换为云端模式。
本项目具备强大的文档处理能力:在 Ingestion 阶段,支持 PDF、Markdown、Python、SQL 等 17 种文件格式,并提供灵活的重复文件处理策略;在 Chunking 阶段,支持 Token 感知的智能切分、Late Chunking 以及利用 LLM 生成上下文的 Contextual Augmentation 技术;在 Retrieval 阶段,通过 Hybrid Search(结合 Dense 与 Sparse 检索)与 CrossEncoder Rerank 技术,确保检索结果的精准度与相关性。
在开始之前,请确保您的开发环境已安装 Python 3.11 或更高版本,并安装了 Poetry 包管理工具。此外,由于本项目支持本地化部署,您需要准备一个 LLM 后端,推荐使用 Ollama 以获得最便捷的本地运行体验。
您可以通过 Poetry 进行快速安装。首先,在项目根目录下运行 `poetry install` 以安装所有必要的依赖(包括开发环境依赖)。安装完成后,建议运行 `poetry run pytest tests/e2e/` 执行端到端测试,以确保在本地 localhost:8000 环境下服务运行正常。
快速上手非常简单:首先通过 `poetry install` 完成安装,随后进入配置阶段。您可以直接使用 Chat UI 进行交互式对话,或者通过 `curl` 命令向 `/chat` 接口发送 JSON 请求来测试文��问答功能。对于开发者,系统还提供了 Swagger UI 方便进行 API 测试。
项目的配置采用 YAML 格式。系统启动时会加载 `config/defaults.yaml` 作为默认配置,并使用 `config/local.yaml` 进行深度合并覆盖。您可以根据需要通过环境变量 `DOT_CONFIG_PATH` 指定自定义配置文件路径。在配置 LLM 后端时,请务必正确设置 `llm.backend`(如 'ollama' 或 'openai')以及对应的 `model` 参数。
本项目提供了完整的 RESTful API 接口,您可以通过访问 `/docs` (Swagger UI) 或 `/redoc` 获取交互式文档。核心接口包括用于文件上传与向量化存储的 `/ingest`、用于对话流式输出的 `/chat` 以及 `/chat/stream`。此外,`/admin/*` 系列接口允许您管理 Collection、查看文档分片(Chunks)详情及监控系统状态。
本项目拥有高度模块化的 Query Pipeline(查询流水线),所有阶段均可根据需求通过配置独立开启或关闭。流水线支持 Query Decomposition(将复杂查询拆解为子查询)、HyDE(生成假设性文档进行嵌入)、Hybrid Search(结合 BM25 的混合检索)以及 CrossEncoder Rerank(重排序)和 Corrective Retrieval(纠错检索),从而实现从用户提问到精准答案的高质量转化。
如果您在使用过程中遇到问题,可以通过 Chat UI 直接提问,或者使用 `curl` 模拟客户端请求进行调试。对于系统状态的检查,可以访问 `/health` 接口确认服务存活状态,或通过 `/status` 查看当前加载的模型、文档计数及向量库信息。
高质量开源AI工具,实现智能文档生成
该工具使用 CC-BY-SA-4.0 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
📄 CC-BY-SA-4.0 — 请查阅原始协议条款了解具体使用限制。
总体来看,document-assistant AI技能包 是一款质量良好的AI工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | document-assistant |
| 原始描述 | 开源AI工具:RAG (Retrieval-Augmented Generation) framework of merging private vector databas。⭐9 · Python |
| Topics | RAG文档生成AI工具 |
| GitHub | https://github.com/gosha70/document-assistant |
| License | CC-BY-SA-4.0 |
| 语言 | Python |
收录时间:2026-05-16 · 更新时间:2026-05-30 · License:CC-BY-SA-4.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。