Skip to main content

A simple, unified interface for RAG across multiple vector store backends (txtai, Chroma, Qdrant, LightRAG)

Project description

simplerags

A simple, unified interface for RAG (Retrieval-Augmented Generation) across multiple vector store backends.

simplerags wraps txtai, Chroma, Qdrant, and LightRAG behind a consistent three-function API so you can swap backends without rewriting your pipeline.

save_<backend>(chunks, rag_root, embed_model, ...)  → index documents
search_<backend>(query, rag_root, embed_model, ...) → retrieve chunks
query_<backend>(query, rag_root, llm_model, ...)    → retrieve + answer

All LLM and embedding calls go through LiteLLM, meaning any model provider (OpenAI, Anthropic, Cohere, Ollama, etc.) works out of the box.


Installation

Install the core package plus the backends you need:

# Qdrant only
pip install simplerags[qdrant]

# Chroma only
pip install simplerags[chroma]

# txtai only
pip install simplerags[txtai]

# LightRAG only
pip install simplerags[lightrag]

# All backends + document loading helpers
pip install simplerags[all]

Add [docs] to get PDF and TXT loading via LangChain:

pip install simplerags[qdrant,docs]

Quick start

Index raw text chunks

from simplerags import save_qdrant, search_qdrant, query_qdrant

chunks = [
    "The Eiffel Tower was completed in 1889.",
    "The Louvre is the world's largest art museum.",
    "Paris is the capital of France.",
]

embed_model = "text-embedding-3-small"   # any LiteLLM-compatible model
llm_model   = "gpt-4o-mini"
rag_root    = "./my_rag_index"

# 1. Index
save_qdrant(chunks, rag_root, embed_model)

# 2. Semantic search
results = search_qdrant("When was the Eiffel Tower built?", rag_root, embed_model)

# 3. RAG query → answer + source chunks
answer, sources = query_qdrant(
    "When was the Eiffel Tower built?", rag_root, llm_model, embed_model
)
print(answer)

Load documents from disk

from simplerags import chunk_docs, save_chroma, query_chroma

chunks = chunk_docs("./my_docs/", chunk_size=800, chunk_overlap=120)
save_chroma(chunks, "./chroma_index", embed_model="text-embedding-3-small")

answer, sources = query_chroma(
    "What does the contract say about termination?",
    rag_root="./chroma_index",
    llm_model="gpt-4o",
    embed_model="text-embedding-3-small",
)

Using Ollama (local models)

from simplerags import save_txtai, query_txtai

save_txtai(chunks, "./txtai_index", embed_model="ollama/bge-m3:latest")

answer, sources = query_txtai(
    "What happened in the news?",
    rag_root="./txtai_index",
    llm_model="ollama/gemma3:8b",
    embed_model="ollama/bge-m3:latest",
)

Backends at a glance

Backend Best for Index format Notes
Qdrant Production workloads, filtering Local files or server Cosine similarity, rich payload filtering
Chroma LangChain ecosystems Local SQLite Easy LangChain integration
txtai All-in-one HuggingFace pipelines SQLite + FAISS Built-in pipeline support
LightRAG Knowledge-graph RAG Local JSON + vector Graph-enhanced hybrid retrieval

API reference

chunk_docs

chunk_docs(docs_path, chunk_size=800, chunk_overlap=120)  list[str]

Recursively loads .pdf and .txt files from docs_path and returns text chunks.

save_<backend>

save_qdrant(chunks, rag_root, embed_model)
save_chroma(chunks, rag_root, embed_model)
save_txtai(chunks, rag_root, embed_model)
save_lightrag(chunks, rag_root, embed_model, llm_model)

search_<backend>

results: list[str] = search_qdrant(query, rag_root, embed_model, top_k=3)

Returns the top_k most relevant chunk texts.

query_<backend>

answer, sources = query_qdrant(query, rag_root, llm_model, embed_model, top_k=3)

Returns (answer_string, list_of_source_chunks).


Contributing

git clone https://github.com/yourname/simplerags
cd simplerags
pip install -e ".[dev]"
pre-commit install
pytest

License

MIT – see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bibirags-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bibirags-0.1.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file bibirags-0.1.0.tar.gz.

File metadata

  • Download URL: bibirags-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for bibirags-0.1.0.tar.gz
Algorithm Hash digest
SHA256 47c26003ca4db4bb72105a02236e89d7d8f2258cc709b6cf42623a3b69203869
MD5 75644908b8d6d1c30dbf08ec856c329d
BLAKE2b-256 8059070bb978f1a9d33e581b0844cffc2ddcd1719888872bdde45cb8baa14f23

See more details on using hashes here.

File details

Details for the file bibirags-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bibirags-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for bibirags-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37b94aab51427a438a3afe6541c94c6d0cb07b84344e1116c3d7cdd793c4f936
MD5 9eab419a88e8ce83370ad0ecbff173f1
BLAKE2b-256 2d679f415c021a13b7d06b831dc819d670cea0baad7f7f611555459a21b8c8c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page