Skip to main content

protoRAG

Zero-infrastructure, in-memory RAG prototyping framework for Python. Vector, BM25, and hybrid search with pluggable backends, durable persistence, and Hugging Face tool integration — all in one process, no external service.

Features

  • Hybrid retrieval — vector + Okapi BM25 with RRF or linear score fusion, exact-match metadata filters
  • Pluggable backends — vector stores: numpy, usearch (default), chromadb; embedders: fastembed (default, CPU/ONNX), torch, sentence-transformers
  • CPU-first — the base install needs no GPU and no PyTorch
  • Durable indexes — atomic save() / load() with a self-describing manifest and explicit compatibility errors; score round-trip < 1e-5
  • Agent-readyto_tool() emits a valid HF transformers tool schema and a plain callable (optional smolagents wrapper)
  • Strictly typedmypy --strict clean, py.typed marker included

Installation

Python 3.9 – 3.13.

pip install protorag                 # core: numpy + fastembed + usearch
pip install "protorag[full]"         # + PyTorch / transformers / sentence-transformers / chromadb
pip install "protorag[chroma]"       # + chromadb only

Quickstart

from protorag import ProtoRAG, SearchMode

rag = ProtoRAG(vector_backend="numpy", embedding_backend="fastembed")
rag.add_texts(
    [
        "The Apollo 11 mission landed humans on the Moon in July 1969.",
        "Python is a high-level, general-purpose programming language.",
        "Transformers and self-attention mechanisms revolutionized "
        "natural language processing.",
    ],
    metadatas=[
        {"source": "history"},
        {"source": "programming"},
        {"source": "nlp"},
    ],
)

for hit in rag.search("Apollo 11 Moon 1969", top_k=1, mode=SearchMode.BM25):
    print(hit.score, hit.content, hit.metadata)

# Hybrid is the default mode:
rag.search("Apollo space mission NLP", top_k=2)

# Persistence + agent tooling:
rag.save("./my_index")
rag2 = ProtoRAG.load("./my_index")
tool = rag2.to_tool(name="my_kb", description="A knowledge base.")
tool(query="What happened on the Moon in 1969?")
tool.to_json_schema()

Documentation

  • Getting started — installation, backends, hybrid search, persistence, tool integration
  • Architecture — component map, score conventions, fusion math, serialization format, performance targets

Development

pip install ".[dev]"
ruff check src/protorag     # lint
mypy --strict src/protorag  # type check
pytest -m "not network" -q  # offline test suite
pytest -q                   # full suite (downloads the default BGE model once)

CI (.github/workflows/): test-cpu.yml runs the py3.9–3.13 matrix with lint + mypy + offline tests; test-full.yml runs the full suite with PyTorch backends and network tests; release.yml builds and publishes on v* tags.

License

Apache License 2.0

Download files

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

Source Distribution

protorag-0.1.0.tar.gz (53.2 kB view details)

Uploaded Source

Built Distribution

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

protorag-0.1.0-py3-none-any.whl (48.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: protorag-0.1.0.tar.gz
  • Upload date:
  • Size: 53.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for protorag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e47cfed8327a7a037bf7872268de817809ff864ab7551b58039a9015757c97cc
MD5 db31953c03f78643c0447ddcb65d6207
BLAKE2b-256 17c569b6afd085f7a91c20a8082718d3bf51a0fea03c919008230a802c41f3be

See more details on using hashes here.

Provenance

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

Publisher: release.yml on eabjab/protoRAG

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

File details

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

File metadata

  • Download URL: protorag-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 48.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for protorag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 288ef3b04ad355c3e70344bb3b69107594fa0a8f49e8fb90ead0a5e23dc657ab
MD5 83b1e177359aa69284de3b3e18d87729
BLAKE2b-256 37274872a70fe37f6b6134b75811180e3f9183268d91011ce7f689fd0d340f98

See more details on using hashes here.

Provenance

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

Publisher: release.yml on eabjab/protoRAG

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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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