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:
Supports Faiss, BM25, ChromaDB, ElasticSearch, and mixed retrieval methods.
Post-Retrieval:
Includes advanced re-ranking methods like LLM Rerank, ColbertRerank, CohereRerank, and ObjectRerank for accurate data prioritization.
Data Updates:
Allows addition and modification of text and Python objects.
Data Storage and Recovery:
Saves vectorized data to avoid re-vectorization during future queries.
Preparation
Installation
Install the RAG module using the following commands:
# From PyPI
pip install strataai[rag]
# From source
pip install -e .[rag]
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:
# Example for OpenAI
embedding:
api_type: "openai"
base_url: "YOUR_BASE_URL"
api_key: "YOUR_API_KEY"
dimensions: "MODEL_DIMENSIONS"
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.