Skip to main content

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 RAG
  • hybrid - 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].json

Example 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 in MODELS_REGISTRY:
  • gpt-4o - OpenAI GPT-4o
  • gpt-5 - OpenAI GPT-5
  • gpt-5.2 - OpenAI GPT-5.2
  • google/medgemma-1.5-4b-it - Medical-specialized model
  • And other models configured in the registry

How It Works

Output File

Results are saved to results/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_REGISTRY
3

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 to results/ragas_comprehensive_all_rags_all_models_[timestamp].json
This is the most comprehensive evaluation and can take several hours to complete. It processes:
  • 6 RAG architectures × N models × 10 questions
Recommended for final benchmarking and research publication.

Evaluation with Debug Output

Enable debug mode for detailed logging:
Debug mode shows:
  • First 2 questions with full context
  • Detailed error traces
  • Metric calculation steps

Viewing Results

All evaluation results are saved as JSON files in the results/ directory:
Use a JSON viewer or Python script to analyze results. Each file contains:
  • Metadata (timestamp, model, RAG type)
  • Summary metrics (aggregated scores)
  • Question-by-question breakdown
  • Performance metrics (tokens, cost, execution time)

Troubleshooting

Ensure you’re running from the project root:
Run the embeddings creation script first:
This can happen with async timeout issues. The system automatically falls back to synchronous mode:
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