Skip to main content

rag-titan

A Swiss Army knife for RAG (Retrieval-Augmented Generation).

rag-titan puts many types of RAG in one small, beginner-friendly Python package. Every part (loader, chunker, embedder, vector store, reranker, generator) is a small class you can read in a minute and replace with your own.

PyPI Python License: MIT

rag-titan overview: indexing and answering

Features

RAG type How it works
simple Retrieve → Rerank → Generate
adaptive Route the question → Retrieve → Check evidence → Rewrite and retry

More RAG types (corrective, hybrid, multi-query, graph, agentic, ...) are planned. See the roadmap.

  • Runs 100% locally with Ollama, so your data stays on your machine.
  • Reads PDF and DOCX files.
  • Answers are grounded in your documents and cite the chunks they used.
  • Every part is swappable. You only need to inherit from one base class.
  • Includes a rag-titan command line tool.

Simple RAG

Simple RAG flow with example scores

Adaptive RAG

Adaptive RAG flow with routes and retries

Installation

pip install rag-titan

Then install Ollama and pull the default models:

ollama pull gemma3:4b          # chat model
ollama pull nomic-embed-text   # embedding model

Quick start

from rag_titan import RAGTitan

rag = RAGTitan(rag_type="simple")        # or "adaptive"
rag.index(["handbook.pdf", "policy.docx"])

print(rag.ask("How many leave days do I get?"))
# You get 20 leave days every year [chunk_0].

Change any setting in code:

rag = RAGTitan(
    rag_type="adaptive",
    settings={"llm_model": "llama3.2", "chunk_size": 200, "reranker": "none"},
)

Command line

rag-titan ask  --files handbook.pdf --question "How many leave days?"
rag-titan chat --files handbook.pdf policy.docx --rag-type adaptive

rag-titan command line demo

Configuration

Settings come from environment variables or a .env file. Copy .env.example to get started. Every setting has a default.

Variable Default Meaning
LLM_MODEL gemma3:4b Chat model used for answers
EMBED_MODEL nomic-embed-text Embedding model
OLLAMA_HOST http://localhost:11434 Ollama server address
CHUNK_SIZE 150 Words per chunk
CHUNK_OVERLAP 30 Words shared between chunks
RERANKER keyword keyword or none

See the configuration docs for the full list.

How it works

Indexing pipeline: load, chunk, embed, store

Every building block is swappable

Agents

A small tool-calling agent loop is included. See the agents docs.

Agent loop with an example trace

Project layout

src/rag_titan/
├── app.py            RAGTitan: the easy, all-in-one class
├── cli.py            the `rag-titan` command
├── config.py         settings from .env / environment
├── factory.py        builds the right class for each setting
├── prompts.py        every RAG prompt in one place
├── llm/              chat models (Ollama)
├── loaders/          PDF and DOCX readers
├── chunking/         split text into chunks
├── embeddings/       text -> vectors
├── vector_stores/    save and search vectors
├── retrieval/        retriever + rerankers
├── generation/       write the final answer
├── pipelines/        indexing pipeline
├── rag_types/        simple and adaptive RAG
├── agents/           tool-calling agents
└── utils/            logging

Documentation

Full docs live in docs/. To view them locally:

pip install -e ".[docs]"
mkdocs serve

Contributing

Contributions are welcome. Please read CONTRIBUTING.md.

License

MIT

Metadata

Release files for rag-titan 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-titan 0.1.0
File Size Uploaded Provenance Actions
rag_titan-0.1.0.tar.gz 23.1 kB With provenance Details for rag_titan-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 59.8 kB

Release files / rag_titan-0.1.0.tar.gz

Download URL rag_titan-0.1.0.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
60c836d6a4a85584b7bb2a9e18dcca501873d6c59a9063ea9cb474a5a33d15c6
BLAKE2b-256 checksum
How to use checksums
d1ed87d87200b68e408017ece7b58d736df6321c661350ca9e2c5d39ab3ef1a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

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

Download URL rag_titan-0.1.0-py3-none-any.whl
Size 36.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e8cb107bc0e5ff9d1c09364ec8f45e33c84ab5514acca5bd63b66d73d8f0f80
BLAKE2b-256 checksum
How to use checksums
87ce7fb0dd6ceddf10fe42b71d0bcb2866d12ff3c540e5d9798a4ec9966bc4e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Security for rag-titan 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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rag_titan-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 Nov 10, 2026.

Transparency log

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.

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