- Operating System: macOS, Linux, or Windows with WSL2
- Python: Version 3.11 or higher
- Memory: 2GB available RAM
- Storage: 5GB free disk space
- Docker: For running InterSystems IRIS database
- Memory: 4GB+ available RAM for better performance
- Storage: 10GB+ for larger document collections
- Internet: For downloading models and API access
- Docker and Docker Compose: For database management
- Git: For cloning the repository
- macOS: Download Docker Desktop from docker.com
- Linux: Follow the official Docker installation guide
- Windows: Install Docker Desktop with WSL2 backend
# Clone the repository
git clone <repository-url>
cd rag-templates
# Make CLI tools executable (if applicable, e.g. ragctl)
# chmod +x ragctl # Assuming ragctl is a script# Create Python virtual environment (.venv) and install dependencies
make setup-env
make install
# Activate the environment for your current session
source .venv/bin/activate # On Windows: .venv\Scripts\activate# Create Python virtual environment
python3 -m venv .venv
# Activate the environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install the project in editable mode (optional, for development)
pip install -e .# Start InterSystems IRIS database
docker-compose up -d
# Verify it's running
docker ps | grep iris_db_rag_standalone# Set up database schema
make setup-db
# Load sample documents for testing
make load-data
# Verify everything works
make validate-iris-ragThe system uses a main configuration file at config/config.yaml. For most users, the default settings work well.
database:
db_host: "localhost"
db_port: 1972
db_user: "SuperUser"
db_password: "SYS"
db_namespace: "USER"embedding_model:
name: "sentence-transformers/all-MiniLM-L6-v2"
dimension: 384For sensitive information like API keys, use environment variables:
# LLM API Keys (optional, for advanced features)
export OPENAI_API_KEY=your-openai-api-key
# Database connection (only if different from defaults)
export IRIS_HOST=localhost
export IRIS_PORT=1972
export IRIS_USERNAME=SuperUser
export IRIS_PASSWORD=SYSThe system automatically manages database schema changes when you update configurations. You don't need to manually handle database migrations - the system detects changes and updates the schema automatically.
from iris_vector_rag import create_pipeline
# Create a basic RAG pipeline (auto-validates database setup)
pipeline = create_pipeline(pipeline_type="basic", validate_requirements=True)
# Ask a question - standardized API across all pipelines
result = pipeline.query("What is machine learning?", top_k=5)
print(f"Answer: {result['answer']}")
print(f"Found {len(result['retrieved_documents'])} relevant documents")
# Access retrieved contexts (RAGAS compatible)
for i, context in enumerate(result['contexts'], 1):
print(f"Context {i}: {context[:100]}...")
# Access source metadata (LangChain compatible)
for doc in result['retrieved_documents']:
print(f"Source: {doc.metadata.get('source', 'Unknown')}")# Load documents from a folder
make load-data
# Load from a specific directory
python -c "
from data.loader_fixed import process_and_load_documents
result = process_and_load_documents('path/to/your/documents', limit=100)
print(f'Loaded: {result}')
"- Text files:
.txt,.md - PDF documents:
.pdf(requires additional setup) - Word documents:
.docx(requires additional setup) - Structured data:
.json,.csv
# See how many documents are in the system
make check-data# Remove all documents (use with caution!)
make clear-rag-datafrom iris_vector_rag import create_pipeline
# Create a pipeline
pipeline = create_pipeline("basic")
# Ask questions
result = pipeline.query("What is photosynthesis?")
print(result["answer"])# Get more detailed results
result = pipeline.query(
"Explain machine learning algorithms",
top_k=10, # Get more source documents
include_sources=True # Include source information
)
# See what sources were used
for doc in result['retrieved_documents']:
print(f"Source: {doc.metadata.get('source', 'Unknown')}")
print(f"Content preview: {doc.page_content[:100]}...")# Test a specific pipeline
make test-pipeline PIPELINE=basic
# Run comprehensive tests
make test-1000The system supports 6 production-ready RAG techniques with unified API:
- Best for: General question answering, simple use cases
- Features: Standard vector similarity search
- Example:
pipeline = create_pipeline("basic")
- Best for: Improved precision in document retrieval
- Features: Over-retrieval with cross-encoder reranking
- Example:
pipeline = create_pipeline("basic_rerank")
- Best for: Self-correcting, high-quality answers
- Features: Automatic relevance evaluation and correction
- Example:
pipeline = create_pipeline("crag")
- Best for: Complex knowledge graphs, multi-hop reasoning
- Features: Vector + Text + Graph search with RRF fusion
- Example:
pipeline = create_pipeline("graphrag") - Requires:
pip install rag-templates[hybrid-graphrag]
- Best for: Precision retrieval with late interaction
- Features: ColBERT-style token-level matching
- Example:
pipeline = create_pipeline("pylate_colbert")
- Best for: Academic papers, 3D visualization
- Features: Global community detection, hierarchical summaries
- Direct import:
from iris_rag.pipelines.iris_global_graphrag import ...
# Load your company documents
pipeline = create_pipeline("basic")
# Ask questions about your documents
answer = pipeline.query("What is our return policy?")
print(answer["answer"])# Use CRAG for self-correcting research
pipeline = create_pipeline("crag")
# Ask complex research questions
result = pipeline.query("What are the latest developments in AI?")
print(result["answer"])# Check if IRIS database is running
docker ps | grep iris_db_rag_standalone
# If not running, start it
docker-compose up -d
# Test connection
make test-dbapi# Check if documents are loaded
make check-data
# If no documents, load sample data
make load-data