Skip to main content

rag-starter

GitHub Sponsor   Buy Me a Coffee   Ko-Fi   PayPal

RAG boilerplate with vector DB adapters.

rag-starter is a lightweight Python starter for retrieval-augmented generation workflows. It gives you a small but clean foundation for:

  • chunking documents.
  • generating embeddings.
  • indexing vectors through adapter classes.
  • retrieving relevant context for prompts.
  • swapping vector backends without rewriting your pipeline.

This repo is intentionally minimal. It is designed as a starter, not a full framework.

Features

  • Small, readable Python package structure.
  • Adapter interface for vector stores.
  • In-memory adapter included for local development and tests.
  • Optional adapter stubs for Chroma, Qdrant, and Pinecone.
  • Simple hashing embedder for demos and bootstrapping.
  • Retriever and RAG pipeline helpers.
  • Example script and tests.

Project structure

rag-starter/
├── examples/
│   └── basic_usage.py
├── src/
│   └── rag_starter/
│       ├── adapters/
│       │   ├── base.py
│       │   ├── chroma.py
│       │   ├── inmemory.py
│       │   ├── pinecone.py
│       │   └── qdrant.py
│       ├── chunking.py
│       ├── document.py
│       ├── embedder.py
│       ├── pipeline.py
│       ├── prompts.py
│       ├── retriever.py
│       └── utils.py
├── tests/
│   ├── test_chunking.py
│   └── test_pipeline.py
├── pyproject.toml
└── README.md

Install

pip install -e .

Optional extras:

pip install -e .[chroma]
pip install -e .[qdrant]
pip install -e .[pinecone]

Quick start

from rag_starter.adapters.inmemory import InMemoryVectorStore
from rag_starter.chunking import chunk_text
from rag_starter.document import Document, Chunk
from rag_starter.embedder import HashingEmbedder
from rag_starter.pipeline import RAGPipeline

source = Document(
    id="doc-1",
    text="RAG combines retrieval with generation. Vector databases help store embeddings.",
    metadata={"title": "RAG Notes"},
)

chunks = [
    Chunk(id=f"chunk-{i}", document_id=source.id, text=text, metadata=source.metadata)
    for i, text in enumerate(chunk_text(source.text, chunk_size=60, overlap=10), start=1)
]

embedder = HashingEmbedder(dimensions=64)
store = InMemoryVectorStore()
pipeline = RAGPipeline(store=store, embedder=embedder)

pipeline.index_chunks(chunks)
result = pipeline.retrieve("What helps store embeddings?", top_k=2)

for item in result.matches:
    print(item.score, item.chunk.text)

Adapter model

All vector database backends follow the same interface defined in VectorStoreAdapter.

Core methods:

  • upsert(items)
  • query(vector, top_k, filters=None)
  • delete(ids)
  • clear()

The included InMemoryVectorStore is useful for:

  • local development.
  • tests.
  • learning the architecture.
  • quickly bootstrapping a prototype.

The optional adapters are intentionally thin wrappers so you can extend them to fit your preferred backend configuration.

What this starter does not try to do

This starter does not include:

  • model serving.
  • background ingestion workers.
  • file loaders for every format.
  • advanced ranking pipelines.
  • production auth and tenancy layers.

Those are highly project-specific and are better layered on once your retrieval path is clear.

Development

Run tests:

python -m unittest discover -s tests -v

License

MIT

Metadata

Release files for rag-starter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rag-starter 0.1.0
File Size Uploaded Provenance
rag_starter-0.1.0.tar.gz 10.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rag-starter 0.1.0
File Interpreter ABI Platform
rag_starter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.1 kB

Release files / rag_starter-0.1.0.tar.gz

Download URL rag_starter-0.1.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8f253a1f3d019ba9725097df6df667f3e5d5795674f4bcec5472d9893f63bcd7
BLAKE2b-256 checksum
How to use checksums
a527534ad3dc4725f3a98872de7c24af057ed3cf754cf891b507679781604fff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / rag_starter-0.1.0-py3-none-any.whl

Download URL rag_starter-0.1.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7bc90aba8f4aa47632ecd408d2899571c044ddfc1a430d70e9bba7460bfb0bd
BLAKE2b-256 checksum
How to use checksums
1eecaeb7cea8407927603f4ec9c88c2c2e76a7fa0526bd494943fc5fb39ba304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for rag-starter 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page