GH

ggozad/haiku.rag

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

667 stars 62 forks 质量 73 趋势 22MIT

本地和自托管文档搜索的代理 RAG:在嵌入式 LanceDB 上实现混合检索、重新排序和多模态 RAG,支持 Docling 解析和 MCP 服务器

概览

代理性RAG,通过页码和章节标题的引用回答你自己文档的问题。本地嵌入式数据库运行,无需服务器。 基于LanceDB、Pydantic AI和Docling构建。完整文档见 ggozad.github.io/haiku.rag。 - — 矢量+全文,支持倒数秩融合 - — 多模态嵌入器(vLLM、VoyageAI、Cohere)将图片矢量置于与文本相同的空间;支持文本即查询→图命中和图像即查询 - — 具备RAG功能及引用(页码、章节标题)- — 具备视觉功能的模型在块文本旁接收图形字节;在问、分析、MCP和聊天TUI中为问题附加您自己的图片 - — 本地交叉编码器、Cohere、Zero Entropy或vLLM - — 通过沙盒Python代码执行复杂分析任务(聚合、计算、多文档分析)- — 可选功能,将请求中先前问题的搜索结果替换为所引用的证据,从而停止长时间对话......

概述(AI 翻译)

代理式RAG,通过页码和章节标题的引用回答你自己文档的问题。它默认运行在嵌入式LanceDB数据库上,通过Ollama开模型,因此不需要服务器或API密钥。Pydantic AI支持的任何供应商都可以替代它们,同一个数据库可以运行在S3、GCS、Azure或LanceDB云上。

基于LanceDB、Pydantic AI和文档管理。文档来源:ggozad.github.io/haiku.rag。

特色

  • 用文档导入PDF、办公文档、HTML、Markdown和图片,无论是在流程中还是docling-serve。存储的文档文档保留标题、表格、图片和页面来源。
  • 搜索,支持混合向量与全文检索,可选重新排序(交叉编码器、Jina、Cohere、Zero Entropy、vLLM、OpenRouter)、区域感知上下文扩展,以及多模嵌入器图像搜索(vLLM、OpenRouter、VoyageAI、Cohere)。同时跨多个命名数据库。
  • Answer 具有 RAG 功能:它搜索、运行沙箱 Python 用于计数和汇总文档,并引用页码和标题。视觉模型接收数据。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

haiku.rag

Agentic RAG that answers questions about your own documents with citations to page numbers and section headings. It runs on an embedded LanceDB database with open models through Ollama by default, so no server or API key is needed. Any provider Pydantic AI supports works in their place, and the same database can live on S3, GCS, Azure or LanceDB Cloud.

Built on LanceDB, Pydantic AI and Docling. Documentation: ggozad.github.io/haiku.rag.

Features

  • Ingest PDFs, office documents, HTML, Markdown and images with Docling, in-process or on docling-serve. The stored DoclingDocument keeps headings, tables, pictures and page provenance.
  • Search with hybrid vector and full-text retrieval, optional reranking (cross-encoders, Jina, Cohere, Zero Entropy, vLLM, OpenRouter), section-aware context expansion, and image search with a multimodal embedder (vLLM, OpenRouter, VoyageAI, Cohere). Across several named databases at once.
  • Answer with the RAG capability: it searches, runs sandboxed Python over the documents for counting and aggregation, and cites page numbers and headings. Vision models receive the figures. Optional capabilities compact earlier evidence in long conversations and require every answer to declare its grounding.
  • Check a citation by drawing its chunk on the page image, from the CLI, the chat TUI or Python.
  • Integrate through the Python API, native Pydantic AI capabilities, plugin hooks that observe document writes and transform searches, an MCP server for Claude Code, Codex and Claude Desktop, and a reference web app.
  • Operate with the haiku-ingester service (filesystem, HTTP, S3 and WebDAV sources, a SQLite or Postgres job queue with retries, a control plane and dashboard), tags and rollback, vacuum, and haiku-rag doctor health checks.

Installation

Python 3.12 or newer.

pip install haiku.rag        # Docling, the VoyageAI and Cohere embedders, every reranker, the TUI
pip install haiku.rag-slim   # the core, with extras chosen by you
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →