No description
Find a file
2025-07-19 00:19:16 +01:00
.github Github action for docs 2025-06-25 20:17:31 +03:00
docs Update docs on configuration changes 2025-07-14 12:00:03 +03:00
src/haiku/rag Fix docstrings 2025-07-16 19:06:54 +03:00
tests Store haiku.rag version, enabling upgrades 2025-07-16 18:21:41 +03:00
.dockerignore Add minimal Dockerfile and docker-compose.yml for containerized development 2025-06-24 15:32:20 +01:00
.gitignore Add minimal Dockerfile and docker-compose.yml for containerized development 2025-06-24 15:32:20 +01:00
.pre-commit-config.yaml mkdocs precommit hook 2025-06-26 11:49:19 +03:00
.python-version Ease python reqs to 3.10, addd classifiers 2025-06-19 12:21:56 +02:00
build-multiplatform.sh Add minimal Dockerfile and docker-compose.yml for containerized development 2025-06-24 15:32:20 +01:00
docker-compose.yml Add minimal Dockerfile and docker-compose.yml for containerized development 2025-06-24 15:32:20 +01:00
Dockerfile Add minimal Dockerfile and docker-compose.yml for containerized development 2025-06-24 15:32:20 +01: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 Store haiku.rag version, enabling upgrades 2025-07-16 18:21:41 +03:00
README.md Merge commit '20beb23a389778461e8280f1442ea196e52182e3' into dockerise 2025-07-19 00:19:16 +01:00
uv.lock Store haiku.rag version, enabling upgrades 2025-07-16 18:21:41 +03: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
  • 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, audio, 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
    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/

Docker

docker pull topiaruss/haiku-rag:latest
docker compose up

docker-compose.yml file

  • When this runs, a documents directory will be created in this directory. You can drag files here to be indexed.

  • A database directory will be created to hold your haiku-rag.db.

  • The compose file mounts your local ~/.ollama/models directory into which you should pull in the normal way the models you want to use. These will then be accessible inside the running container.

For production, expect to edit the docker-compose.yml file to set a permanent location for your models, database, and document directory.

Consult Docker resources to understand the many possibilities.

build-multiplatform.sh

This is a simple builder to provide a multi-platform image. Replace "topiaruss" with your own dockerhub username, create the haiku-rag image folder, and issue a docker login command

check (tail) the logs

docker compose logs -f