Running Evaluations
This guide shows you how to run RAGAS evaluations on different RAG architectures using the built-in evaluation system.Prerequisites
Before running evaluations, ensure you have:1
Environment Setup
Configure your
.env file with required API keys:2
Install Dependencies
Install all required packages:
3
Create Embeddings
Generate embeddings for the knowledge base:This creates embeddings in
data/embeddings/chroma_db/Single RAG Evaluation
Evaluate a single RAG architecture with the default model.Available RAG Types
simple- Simple Semantic RAGhybrid- Hybrid RAG (BM25 + Semantic)hybrid-rrf- Hybrid RAG + RRF (Reciprocal Rank Fusion)hyde- HyDE RAG (Hypothetical Document Embeddings)rewriter- Query Rewriter RAG (Multi-Query)pageindex- PageIndex RAG
Command
Examples
What Happens
1
Load Test Dataset
The system loads the obstetric questions dataset:
2
Query RAG System
Each question is processed through the selected RAG architecture:
3
Calculate RAGAS Metrics
RAGAS evaluates all four metrics:
4
Save Results
Results are saved to
results/ragas_evaluation_[rag_type]_[timestamp].jsonExample Output
Multi-Model Evaluation
Compare performance across multiple language models for a specific RAG architecture.Command
Examples
Available Models
The system evaluates across all models defined inMODELS_REGISTRY:
gpt-4o- OpenAI GPT-4ogpt-5- OpenAI GPT-5gpt-5.2- OpenAI GPT-5.2google/medgemma-1.5-4b-it- Medical-specialized model- And other models configured in the registry
How It Works
Output File
Results are saved toresults/ragas_multimodel_[rag_type]_[timestamp].json
Multi-model evaluations take significantly longer since each model processes all 10 questions. Expect 10-30 minutes depending on the models tested.
Comprehensive Benchmark
Run a complete evaluation across all RAG architectures and all available models.Command
What This Does
1
Evaluate All RAG Types
Runs evaluations for all 6 RAG architectures:
- Simple Semantic RAG
- HyDE RAG
- Rewriter RAG
- Hybrid RAG
- Hybrid RAG + RRF
- PageIndex RAG
2
Test All Models
Each RAG is tested with every model in
MODELS_REGISTRY3
Generate Comparison Data
Produces comprehensive comparison showing:
- Performance of each RAG architecture
- Model-specific performance variations
- Cross-model consistency
- Optimal configuration identification
Output File
Results are saved toresults/ragas_comprehensive_all_rags_all_models_[timestamp].json
Evaluation with Debug Output
Enable debug mode for detailed logging:- First 2 questions with full context
- Detailed error traces
- Metric calculation steps
Viewing Results
All evaluation results are saved as JSON files in theresults/ directory:
Troubleshooting
Import errors when running evaluation
Import errors when running evaluation
Ensure you’re running from the project root:
ChromaDB not found
ChromaDB not found
Run the embeddings creation script first:
All metrics show NaN
All metrics show NaN
This can happen with async timeout issues. The system automatically falls back to synchronous mode:
API rate limits
API rate limits
RAGAS metrics use OpenAI’s API for evaluation. If you hit rate limits:
- Use a smaller test dataset
- Add delays between evaluations
- Upgrade your OpenAI API tier
Next Steps
Interpreting Results
Learn how to analyze and understand evaluation results
Benchmarking
Best practices for comprehensive RAG benchmarking
