Metadata-Version: 2.5
Name: rag-titan
Version: 0.1.0
Summary: A Swiss Army knife for RAG: simple, adaptive and more RAG types in one beginner-friendly package.
Project-URL: Homepage, https://github.com/aion7891/rag-titan
Project-URL: Documentation, https://aion7891.github.io/rag-titan
Project-URL: Repository, https://github.com/aion7891/rag-titan
Project-URL: Issues, https://github.com/aion7891/rag-titan/issues
Project-URL: Changelog, https://github.com/aion7891/rag-titan/blob/main/CHANGELOG.md
Author: Kumar Nishant
License: MIT License
        
        Copyright (c) 2026 Kumar Nishant
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: embeddings,llm,ollama,rag,retrieval-augmented-generation,vector-search
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Text Processing :: Indexing
Requires-Python: >=3.10
Requires-Dist: numpy>=1.24
Requires-Dist: ollama>=0.4.0
Requires-Dist: pypdf>=4.0
Requires-Dist: pytest>=8.4.2
Requires-Dist: python-docx>=1.1
Requires-Dist: python-dotenv>=1.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Requires-Dist: twine>=5.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
Description-Content-Type: text/markdown

# 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](https://img.shields.io/pypi/v/rag-titan.svg)](https://pypi.org/project/rag-titan/)
[![Python](https://img.shields.io/pypi/pyversions/rag-titan.svg)](https://pypi.org/project/rag-titan/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/aion7891/rag-titan/blob/main/LICENSE)

<p align="center"><img src="https://cdn.jsdelivr.net/gh/aion7891/rag-titan@main/docs/assets/images/overview.svg" alt="rag-titan overview: indexing and answering" width="100%"></p>

## 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](https://github.com/aion7891/rag-titan/blob/main/docs/roadmap.md).

- Runs **100% locally** with [Ollama](https://ollama.com), 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

<p align="center"><img src="https://cdn.jsdelivr.net/gh/aion7891/rag-titan@main/docs/assets/images/simple-rag.svg" alt="Simple RAG flow with example scores" width="100%"></p>

### Adaptive RAG

<p align="center"><img src="https://cdn.jsdelivr.net/gh/aion7891/rag-titan@main/docs/assets/images/adaptive-rag.svg" alt="Adaptive RAG flow with routes and retries" width="100%"></p>

## Installation

```bash
pip install rag-titan
```

Then install [Ollama](https://ollama.com/download) and pull the default models:

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

## Quick start

```python
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:

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

## Command line

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

<p align="center"><img src="https://cdn.jsdelivr.net/gh/aion7891/rag-titan@main/docs/assets/images/cli.svg" alt="rag-titan command line demo" width="100%"></p>

## Configuration

Settings come from environment variables or a `.env` file. Copy
[`.env.example`](https://github.com/aion7891/rag-titan/blob/main/.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](https://github.com/aion7891/rag-titan/blob/main/docs/configuration.md) for the full list.

## How it works

<p align="center"><img src="https://cdn.jsdelivr.net/gh/aion7891/rag-titan@main/docs/assets/images/indexing.svg" alt="Indexing pipeline: load, chunk, embed, store" width="100%"></p>

<p align="center"><img src="https://cdn.jsdelivr.net/gh/aion7891/rag-titan@main/docs/assets/images/architecture.svg" alt="Every building block is swappable" width="100%"></p>

## Agents

A small tool-calling agent loop is included. See the [agents docs](https://github.com/aion7891/rag-titan/blob/main/docs/agents.md).

<p align="center"><img src="https://cdn.jsdelivr.net/gh/aion7891/rag-titan@main/docs/assets/images/agent.svg" alt="Agent loop with an example trace" width="100%"></p>

## 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/`](https://github.com/aion7891/rag-titan/blob/main/docs/index.md). To view them locally:

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

## Contributing

Contributions are welcome. Please read [CONTRIBUTING.md](https://github.com/aion7891/rag-titan/blob/main/CONTRIBUTING.md).

## License

[MIT](https://github.com/aion7891/rag-titan/blob/main/LICENSE)
