Metadata-Version: 2.3
Name: rago
Version: 0.13.0
Summary: Rago is a lightweight framework for RAG
License: BSD 3 Clause
Author: Ivan Ogasawara
Author-email: ivan.ogasawara@gmail.com
Requires-Python: >=3.9,<3.13
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: cohere (>=5.13.4)
Requires-Dist: eval-type-backport (>=0.2) ; python_version < "3.10"
Requires-Dist: faiss-cpu (>=1.9.0)
Requires-Dist: google-generativeai (>=0.8.3)
Requires-Dist: instructor (>=1)
Requires-Dist: joblib (>=1.4.2,<2.0.0)
Requires-Dist: langchain (>=0.3.7)
Requires-Dist: langchain-community (>=0.3.7)
Requires-Dist: langdetect (>=1)
Requires-Dist: numpy (>=2,<2.1) ; python_version < "3.10"
Requires-Dist: numpy (>=2,<=2.2) ; python_version > "3.9"
Requires-Dist: openai (>=1.52.2)
Requires-Dist: pydantic (>=2)
Requires-Dist: pypdf (>=5)
Requires-Dist: sentence-transformers (>=3.2.0)
Requires-Dist: sentencepiece (>=0.2.0)
Requires-Dist: spacy (>=3.8.0) ; python_version > "3.9"
Requires-Dist: spacy (>=3.8.0,<3.8.4) ; python_version < "3.10"
Requires-Dist: torch (>=2,<2.6)
Requires-Dist: transformers (>=4)
Requires-Dist: typeguard (>=4.0)
Description-Content-Type: text/markdown

# Rago

![CI](https://img.shields.io/github/actions/workflow/status/osl-incubator/rago/main.yaml?logo=github&label=CI)
[![Python Versions](https://img.shields.io/pypi/pyversions/rago)](https://pypi.org/project/rago/)
[![Package Version](https://img.shields.io/pypi/v/rago?color=blue)](https://pypi.org/project/rago/)
![License](https://img.shields.io/pypi/l/rago?color=blue)
[![Discord](https://img.shields.io/discord/796786891798085652?logo=discord&color=blue)](https://opensciencelabs.org/discord)

Rago is a lightweight framework for RAG.

- Software License: BSD 3 Clause
- Documentation: https://osl-incubator.github.io/rago

## Features

- Vector Database support
    - FAISS
- Retrieval features
    - Support pdf extraction via langchain
- Augmentation (Embedding + Vector Database Search)
    - Support for Sentence Transformer (Hugging Face)
    - Support for Open AI
    - Support for SpaCy
- Generation (LLM)
    - Support for Hugging Face
    - Support for llama (Huggin FAce)
    - Support for OpenAI
    - Support for Gemini

## Installation

If you want to install it for `cpu` only, you can run:

```bash
$ pip install rago[cpu]
```

But, if you want to install it for `gpu` (cuda), you can run:

```bash
$ pip install rago[gpu]
```

## Setup

### Llama 3

In order to use a llama model, visit its page on huggingface and request your
access in its form, for example: https://huggingface.co/meta-llama/Llama-3.2-1B.

After you are granted access to the desired model, you will be able to use it
with Rago.

You will also need to provide a hugging face token in order to download the
models locally, for example:

```python

from rago import Rago
from rago.generation import LlamaGen
from rago.retrieval import StringRet
from rago.augmented import SentenceTransformerAug

# For Gated LLMs
HF_TOKEN = 'YOUR_HUGGING_FACE_TOKEN'

animals_data = [
    "The Blue Whale is the largest animal ever known to have existed, even "
    "bigger than the largest dinosaurs.",
    "The Peregrine Falcon is renowned as the fastest animal on the planet, "
    "capable of reaching speeds over 240 miles per hour.",
    "The Giant Panda is a bear species endemic to China, easily recognized by "
    "its distinctive black-and-white coat.",
    "The Cheetah is the world's fastest land animal, capable of sprinting at "
    "speeds up to 70 miles per hour in short bursts covering distances up to "
    "500 meters.",
    "The Komodo Dragon is the largest living species of lizard, found on "
    "several Indonesian islands, including its namesake, Komodo.",
]

rag = Rago(
    retrieval=StringRet(animals_data),
    augmented=SentenceTransformerAug(top_k=2),
    generation=LlamaGen(api_key=HF_TOKEN),
)
rag.prompt('What is the faster animal on Earth?')
```

