easy-rag
RAG in 3 lines of code. Zero dependencies. Load documents, ask questions, get answers.
from easy_rag import EasyRAG
rag = EasyRAG("./my_docs/")
answer = rag.ask("What does the contract say about termination?")
print(answer)
That's it. No API keys, no vector databases, no configuration.
Why easy-rag?
| easy-rag | LangChain | LlamaIndex | |
|---|---|---|---|
| Lines to get started | 3 | 50-100+ | 30-80+ |
| Dependencies | 0 | 50+ | 40+ |
| Setup time | Instant | Minutes | Minutes |
| Requires API key | No | Usually | Usually |
| Install size | < 50 KB | 200+ MB | 150+ MB |
Installation
pip install easy-rag
Optional extras
pip install easy-rag[pdf] # PDF support (pdfplumber)
pip install easy-rag[openai] # OpenAI embeddings
pip install easy-rag[local] # Local embeddings (sentence-transformers)
pip install easy-rag[all] # Everything
Quick Start
Search your documents
from easy_rag import EasyRAG
# Load an entire folder of documents
rag = EasyRAG("./contracts/")
# Ask a question
result = rag.ask("What is the payment schedule?")
print(result)
# [contract_v2.pdf | Score: 0.87]
# Payment is due within 30 days of invoice date...
Add documents on the fly
rag = EasyRAG()
# Add individual files
rag.add_document("report.md")
rag.add_document("notes.txt")
# Add raw text directly
rag.add_text("The meeting is scheduled for Friday at 3pm.", source="email")
# Search
results = rag.search("meeting schedule", top_k=3)
for r in results:
print(f"[{r.score:.2f}] {r.chunk.text[:100]}")
CLI usage
# Search documents from the command line
easy-rag ./docs/ "What are the key findings?"
# Show index statistics
easy-rag ./docs/ --stats
# Customize chunk size
easy-rag ./docs/ "query" --chunk-size 1000 --top-k 5
Check index stats
rag = EasyRAG("./docs/")
print(rag.stats())
# {
# 'num_chunks': 142,
# 'num_sources': 12,
# 'num_unique_terms': 3847,
# 'chunk_size': 500,
# 'overlap': 50
# }
Supported File Formats
| Format | Support | Notes |
|---|---|---|
.txt |
Built-in | Plain text files |
.md |
Built-in | Markdown files |
.json |
Built-in | Extracts all string values |
.pdf |
Optional | Requires pip install easy-rag[pdf] |
How It Works
- Load — Reads all supported files from a directory
- Chunk — Splits text into overlapping pieces at smart boundaries (paragraphs, sentences)
- Index — Builds a TF-IDF index using only Python's standard library
- Search — Finds the most relevant chunks using cosine similarity
- Return — Gives you the best matching text with source and score
No neural networks, no API calls, no GPU needed. Just fast, reliable text search.
API Reference
EasyRAG(path=None, chunk_size=500, overlap=50)
Create a new RAG index.
path— Directory or file to load (optional, can add later)chunk_size— Max characters per chunk (default: 500)overlap— Character overlap between chunks (default: 50)
.ask(question, top_k=3) -> RAGResult
Ask a question and get a formatted answer with sources.
.search(query, top_k=5) -> List[SearchResult]
Search for relevant chunks (raw results).
.add_document(filepath) -> int
Add a single file to the index. Returns number of chunks created.
.add_text(text, source="inline") -> int
Add raw text to the index. Returns number of chunks created.
.stats() -> dict
Get index statistics.
License
MIT
Metadata
Release files for easyrag-kit 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 |
|---|---|---|---|---|
| easyrag_kit-0.1.0.tar.gz | 11.2 kB | Without provenance | Details for easyrag_kit-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easyrag_kit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for easyrag_kit-0.1.0-py3-none-any.whl |
Total release size: 25.4 kB
Release files / easyrag_kit-0.1.0.tar.gz
| Download URL | easyrag_kit-0.1.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fc78aba8989ae3f06d3d93d1ed288bc975092332622cab0ac73aec0330ea73a
|
|
BLAKE2b-256 checksum How to use checksums |
60f1bf657c953bd91fe57a53948a2305afe6e5fefb39cf5b5cb1d533e1904f96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / easyrag_kit-0.1.0-py3-none-any.whl
| Download URL | easyrag_kit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfccd338deb8cebc01a4cd468e90e13ba329f863d229f2db855eb0295c68af4c
|
|
BLAKE2b-256 checksum How to use checksums |
b7b560dea91b51478b6d5cbadcba272b0c0c92c2e3a99d6f9aa494ae6b574e3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for easyrag-kit 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.