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-ready —
to_tool()emits a valid HF transformers tool schema and a plain callable (optional smolagents wrapper) - Strictly typed —
mypy --strictclean,py.typedmarker 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e47cfed8327a7a037bf7872268de817809ff864ab7551b58039a9015757c97cc
|
|
| MD5 |
db31953c03f78643c0447ddcb65d6207
|
|
| BLAKE2b-256 |
17c569b6afd085f7a91c20a8082718d3bf51a0fea03c919008230a802c41f3be
|
Provenance
The following attestation bundles were made for protorag-0.1.0.tar.gz:
Publisher:
release.yml on eabjab/protoRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
protorag-0.1.0.tar.gz -
Subject digest:
e47cfed8327a7a037bf7872268de817809ff864ab7551b58039a9015757c97cc - Sigstore transparency entry: 2581957771
- Sigstore integration time:
-
Permalink:
eabjab/protoRAG@f3747ae38cf80828fb6e33f5628e1ab4b36c2089 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/eabjab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f3747ae38cf80828fb6e33f5628e1ab4b36c2089 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
288ef3b04ad355c3e70344bb3b69107594fa0a8f49e8fb90ead0a5e23dc657ab
|
|
| MD5 |
83b1e177359aa69284de3b3e18d87729
|
|
| BLAKE2b-256 |
37274872a70fe37f6b6134b75811180e3f9183268d91011ce7f689fd0d340f98
|
Provenance
The following attestation bundles were made for protorag-0.1.0-py3-none-any.whl:
Publisher:
release.yml on eabjab/protoRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
protorag-0.1.0-py3-none-any.whl -
Subject digest:
288ef3b04ad355c3e70344bb3b69107594fa0a8f49e8fb90ead0a5e23dc657ab - Sigstore transparency entry: 2581957773
- Sigstore integration time:
-
Permalink:
eabjab/protoRAG@f3747ae38cf80828fb6e33f5628e1ab4b36c2089 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/eabjab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f3747ae38cf80828fb6e33f5628e1ab4b36c2089 -
Trigger Event:
push
-
Statement type: