mini-rag
RAG (Retrieval-Augmented Generation) pipeline sederhana menggunakan OpenRouter sebagai gateway LLM/embedding dan ChromaDB sebagai vector database lokal.
Instalasi
pip install mini-rag
Untuk contoh REST API (FastAPI), install dengan extra api:
pip install "mini-rag[api]"
Pemakaian Cepat
from mini_rag import RAGPipeline
rag = RAGPipeline(
api_key="sk-or-xxxxxxxx", # API key dari openrouter.ai
chroma_path="./chroma_db", # lokasi penyimpanan vector database
)
# Ingest dokumen dari folder (mendukung .txt, .pdf, .docx)
rag.ingest_folder("./dokumen")
# Tanya
result = rag.query("Apa itu ChromaDB?")
print(result["answer"])
print(result["sources"])
Fitur
- Ingest dokumen
.txt,.pdf,.docxdari satu folder sekaligus - Deteksi dokumen yang sudah pernah di-ingest (skip otomatis, hemat API call)
- Vector search lokal via ChromaDB, tidak perlu server tambahan
- Model embedding & chat bisa dikustomisasi lewat parameter
Kustomisasi Model
rag = RAGPipeline(
api_key="sk-or-xxxxxxxx",
embed_model="cohere/embed-v4",
chat_model="anthropic/claude-sonnet-4.6",
)
Contoh REST API
Lihat examples/app.py untuk contoh integrasi ke FastAPI (endpoint /ingest dan /query).
cd examples
cp .env.example .env # isi OPENROUTER_API_KEY
uvicorn app:app --reload
Lisensi
MIT
Metadata
Release files for mini-rag-openrouter 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 | |
|---|---|---|---|
| mini_rag_openrouter-0.1.0.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mini_rag_openrouter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / mini_rag_openrouter-0.1.0.tar.gz
| Download URL | mini_rag_openrouter-0.1.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cdb5935d1fb56e12153397a6e7323a4224a212a8b09ff05b7f63f83eebe7357
|
|
BLAKE2b-256 checksum How to use checksums |
37e19658298a182903899bd5c368bb47ec7ce293c9bea085c7c15623f230cea6
|
| 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 Sep 8, 2026.
Transparency logRelease files / mini_rag_openrouter-0.1.0-py3-none-any.whl
| Download URL | mini_rag_openrouter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
030e6a1918fd4470d2cc87e28e89fd0df1d671eb41654e79076c6965c9950f74
|
|
BLAKE2b-256 checksum How to use checksums |
0a8e09cea8ea95f64c1c4436d08ad2fd90d561c729e6d36a55becb147592aca4
|
| 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 Sep 8, 2026.
Transparency log