RAG Module

Overview

The RAG (Retrieval-Augmented Generation) module enhances the capabilities of Large Language Models (LLMs) by allowing them to reference external knowledge bases. This approach ensures:

  • Improved precision and relevance in responses.

  • Access to domain-specific knowledge without requiring model retraining.

  • Practical and authoritative outputs.

Features

The RAG module in Strata AI provides the following functionalities:

  1. Data Input:

    • Supports multiple file formats (e.g., PDF, DOCX, MD, CSV, TXT, PPT).

    • Handles Python objects directly.

  2. Retrieval:

    • Supports Faiss, BM25, ChromaDB, ElasticSearch, and mixed retrieval methods.

  3. Post-Retrieval:

    • Includes advanced re-ranking methods like LLM Rerank, ColbertRerank, CohereRerank, and ObjectRerank for accurate data prioritization.

  4. Data Updates:

    • Allows addition and modification of text and Python objects.

  5. Data Storage and Recovery:

    • Saves vectorized data to avoid re-vectorization during future queries.


Preparation

Installation

Install the RAG module using the following commands:

Note: Some modules, like ColbertRerank, require additional manual installation. For example, install llama-index-postprocessor-colbert-rerank for ColbertRerank.

Embedding Configuration

Set up embeddings in your configuration file:

You can also configure embeddings for Azure, Gemini, or Ollama. For additional types like HuggingFace or Bedrock, use the embed_model field in from_docs or from_objs functions.

Optional: Omniparse Configuration

To optimize PDF parsing, configure Omniparse:

Omniparse is optional. If configured, it is used exclusively for PDF files.


Key Functionalities

1. Data Input

Example 1.1: Files or Directories

Example 1.2: Python Objects


2. Retrieval

Example 2.1: Faiss Retrieval

Example 2.2: Hybrid Retrieval


3. Post-Retrieval

Example 3.1: LLM Re-Ranking


4. Data Updates

Example 4.1: Add Text and Objects


5. Data Storage and Recovery

Example 5.1: Persist and Reload


Last updated