Skip to main content

Tiny RAG with implicit knowledge graph, powered by zvec

Project description

zrag

Tiny RAG with implicit knowledge graph, powered by zvec.

Ingest a directory of any file type into a local vector store. Query with natural language. Explore connections through an implicit knowledge graph — no servers, no API keys.

Install

pip install zerag

For PDF support:

pip install "zerag[pdf]"

Quick Start

CLI

# Index a codebase
zrag ingest ./src

# Search it
zrag query "how does authentication work?"

# Explore the knowledge graph
zrag graph "authentication" --depth 1

# Check stats
zrag stats

Python API

from zrag import ZragStore

with ZragStore("./my_index") as store:
    # Ingest files
    store.ingest("./docs")

    # Query
    results = store.query("how does auth work?", topk=5)
    for r in results:
        print(f"{r['file_path']}:{r['chunk_index']} ({r['score']:.3f})")
        print(f"  {r['content'][:100]}")

    # Knowledge graph
    graph = store.graph("auth", depth=1)
    print(f"{len(graph['nodes'])} nodes, {len(graph['edges'])} edges")

How It Works

Vector search — Files are chunked (~512 chars with paragraph-aware boundaries), embedded locally with all-MiniLM-L6-v2 (384-dim), and stored in a zvec HNSW index. Everything runs in-process.

Implicit knowledge graph — No stored graph. Edges are derived at query time:

  • same_file — chunks from the same file (free from metadata)
  • adjacent — consecutive chunks in a file (free from metadata)
  • similar — chunks above a cosine similarity threshold (computed via zvec)

Supported file types.md, .txt, .py, .js, .ts, .tsx, .jsx, .json, .yaml, .yml, .toml, .csv, .html, .rst, .pdf. Unknown extensions are attempted as UTF-8 text; binary files are skipped.

CLI Reference

zrag [--index PATH] <command>

Commands:
  ingest <dir>   Ingest files from a directory
    --chunk-size   Chunk size in chars (default: 512)
    --overlap      Overlap between chunks (default: 64)

  query <text>   Search the index
    --topk         Number of results (default: 5)

  graph <text>   Build implicit knowledge graph
    --depth        Expansion depth (default: 1)
    --topk         Seed results (default: 5)
    --threshold    Similarity threshold for edges (default: 0.5)

  stats          Show index statistics

Requirements

  • Python 3.10-3.12 (zvec constraint)
  • No API keys, no servers — embeddings run locally

License

MIT — Wayy Research

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zerag-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zerag-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file zerag-0.1.0.tar.gz.

File metadata

  • Download URL: zerag-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zerag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2ca3d9444c7c3950247f6e477afcb485af51f8858b235622d1bb985ad8f7d021
MD5 193d92309aef8847417923fad8cac013
BLAKE2b-256 138363ed27ed40371add28f54890490ce58cd6bc4d458740b13d2735fa26cd2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for zerag-0.1.0.tar.gz:

Publisher: publish.yml on Wayy-Research/zrag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zerag-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zerag-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zerag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a877677ceba3c7c67baa75557377ad641e33f93cde64e5813f47697849ecad8e
MD5 b107e5f6d7d5e07f60baf97d17b12e25
BLAKE2b-256 378bc801c9ebcc033bd1f246d7f93f3e05d81ca42262711e7b3510c6906cc56a

See more details on using hashes here.

Provenance

The following attestation bundles were made for zerag-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Wayy-Research/zrag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page