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
Metadata
Release files for protorag 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| protorag-0.1.0.tar.gz | 53.2 kB | With provenance | Details for protorag-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| protorag-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for protorag-0.1.0-py3-none-any.whl |
Total release size: 101.2 kB
Release files / protorag-0.1.0.tar.gz
| Download URL | protorag-0.1.0.tar.gz |
|---|---|
| Size | 53.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e47cfed8327a7a037bf7872268de817809ff864ab7551b58039a9015757c97cc
|
|
BLAKE2b-256 checksum How to use checksums |
17c569b6afd085f7a91c20a8082718d3bf51a0fea03c919008230a802c41f3be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logRelease files / protorag-0.1.0-py3-none-any.whl
| Download URL | protorag-0.1.0-py3-none-any.whl |
|---|---|
| Size | 48.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
288ef3b04ad355c3e70344bb3b69107594fa0a8f49e8fb90ead0a5e23dc657ab
|
|
BLAKE2b-256 checksum How to use checksums |
37274872a70fe37f6b6134b75811180e3f9183268d91011ce7f689fd0d340f98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logSecurity for protorag 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for protorag-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.