No description
Find a file
2025-08-10 19:49:14 +02:00
.github Github action for docs 2025-06-25 20:17:31 +03:00
docs Make mxbai reranker optional. Only use a reranker if mxbai or cohere are installed 2025-08-10 19:49:14 +02:00
src/haiku/rag Make mxbai reranker optional. Only use a reranker if mxbai or cohere are installed 2025-08-10 19:49:14 +02:00
tests Make mxbai reranker optional. Only use a reranker if mxbai or cohere are installed 2025-08-10 19:49:14 +02:00
.gitignore VoyageAI embeddings 2025-06-18 09:45:36 +02:00
.pre-commit-config.yaml mkdocs precommit hook 2025-06-26 11:49:19 +03:00
.python-version Replace loop.run_until_complete() with asyncio.run() 2025-08-08 12:41:50 +02:00
LICENSE MIT license 2025-06-18 10:17:27 +02:00
mkdocs.yml Document benchmarks 2025-07-08 19:01:54 +03:00
pyproject.toml Make mxbai reranker optional. Only use a reranker if mxbai or cohere are installed 2025-08-10 19:49:14 +02:00
README.md Replace markitdown with docling 2025-08-01 09:59:53 +02:00
uv.lock Make mxbai reranker optional. Only use a reranker if mxbai or cohere are installed 2025-08-10 19:49:14 +02:00

Haiku SQLite RAG

Retrieval-Augmented Generation (RAG) library on SQLite.

haiku.rag is a Retrieval-Augmented Generation (RAG) library built to work on SQLite alone without the need for external vector databases. It uses sqlite-vec for storing the embeddings and performs semantic (vector) search as well as full-text search combined through Reciprocal Rank Fusion. Both open-source (Ollama) as well as commercial (OpenAI, VoyageAI) embedding providers are supported.

Features

  • Local SQLite: No external servers required
  • Multiple embedding providers: Ollama, VoyageAI, OpenAI
  • Multiple QA providers: Ollama, OpenAI, Anthropic
  • Hybrid search: Vector + full-text search with Reciprocal Rank Fusion
  • Reranking: Default search result reranking with MixedBread AI or Cohere
  • Question answering: Built-in QA agents on your documents
  • File monitoring: Auto-index files when run as server
  • 40+ file formats: PDF, DOCX, HTML, Markdown, code files, URLs
  • MCP server: Expose as tools for AI assistants
  • CLI & Python API: Use from command line or Python

Quick Start

# Install
uv pip install haiku.rag

# Add documents
haiku-rag add "Your content here"
haiku-rag add-src document.pdf

# Search
haiku-rag search "query"

# Ask questions
haiku-rag ask "Who is the author of haiku.rag?"

# Rebuild database (re-chunk and re-embed all documents)
haiku-rag rebuild

# Start server with file monitoring
export MONITOR_DIRECTORIES="/path/to/docs"
haiku-rag serve

Python Usage

from haiku.rag.client import HaikuRAG

async with HaikuRAG("database.db") as client:
    # Add document
    doc = await client.create_document("Your content")

    # Search (reranking enabled by default)
    results = await client.search("query")
    for chunk, score in results:
        print(f"{score:.3f}: {chunk.content}")

    # Ask questions
    answer = await client.ask("Who is the author of haiku.rag?")
    print(answer)

MCP Server

Use with AI assistants like Claude Desktop:

haiku-rag serve --stdio

Provides tools for document management and search directly in your AI assistant.

Documentation

Full documentation at: https://ggozad.github.io/haiku.rag/