Prerequisites
Before installing, ensure your system meets these requirements:System Requirements
- Operating System: Linux, macOS, or Windows with WSL2
- Python: Version 3.8 or higher
- Git: For repository cloning
- Internet Connection: Required for API calls and package installation
API Requirements
You’ll need an OpenAI API key to run evaluations. The benchmark uses:
- text-embedding-3-small for creating document embeddings
- GPT-4o (default) or other OpenAI models for answer generation
Installation steps
If Python is not installed or the version is below 3.8, download and install it from python.org.
# LangChain Ecosystem
langchain>=0.2.0
langchain-community>=0.2.0
langchain-chroma>=0.1.0
langchain-openai>=0.1.0
# LLM & API
openai>=1.0.0
tiktoken>=0.5.0
# Vector Database & Retrieval
chromadb>=0.4.0
rank-bm25>=0.2.0
# Data processing
pandas>=2.0.0
numpy>=1.20.0
# Utilities
python-dotenv>=1.0.0
pydantic>=2.0.0
tqdm>=4.60.0
# Evaluation
ragas>=0.2.15,<0.3
datasets>=2.15.0
evaluate>=0.4.0
# OpenAI API configuration (Required)
OPENAI_API_KEY=your_openai_api_key_here
# Optional: HuggingFace models configuration
# Only needed for specialized medical models
HF_TOKEN=your_huggingface_token_here
MEDIPHI_ENDPOINT_URL=https://your_mediphi_endpoint_url
MEDGEMMA_ENDPOINT_URL=https://your_medgemma_endpoint_url
# Optional: PageIndex configuration
PAGEINDEX_API_KEY=your_pageindex_api_key_here
PAGEINDEX_DOC_ID=your_pageindex_doc_id_here
Required: Only
OPENAI_API_KEY is required for basic usage. Other API keys are optional and only needed if you plan to use specialized medical models or PageIndex RAG.RAG-Benchmark/
├── src/
│ ├── rag/ # RAG implementations
│ ├── evaluation/ # RAGAS orchestration
│ └── common/ # Shared utilities
├── scripts/
│ ├── create_embeddings.py # Embedding generation
│ └── run_evaluation.py # Evaluation CLI
├── data/
│ ├── chunks/ # Pre-chunked documents
│ └── embeddings/ # Vector database storage
├── results/ # Evaluation outputs
├── requirements.txt # Python dependencies
├── .env.example # Environment template
└── README.md
data/chunks/chunks_final.jsontext-embedding-3-small modeldata/embeddings/chroma_db/=== STARTING EMBEDDING CREATION PROCESS ===
Loading chunks from: /path/to/data/chunks/chunks_final.json
Successfully loaded 150 chunks.
Initializing OpenAI embeddings model...
Creating and storing vector database at: /path/to/data/embeddings/chroma_db
Collection: guia_embarazo_parto
Embeddings created and stored successfully!
Total vectors in database: 150
Database saved at: /path/to/data/embeddings/chroma_db
=== PROCESS COMPLETED ===
The embedding creation process typically takes 1-2 minutes. It only needs to be run once unless you modify the source documents.
Troubleshooting
Common issues and solutions
ModuleNotFoundError: No module named 'langchain'
ModuleNotFoundError: No module named 'langchain'
Problem: Dependencies not installed or wrong Python environment.Solution:
OpenAI API authentication error
OpenAI API authentication error
Problem: Invalid or missing OpenAI API key.Solution:
- Verify your API key is correct in
.env: - Ensure no extra spaces or quotes around the key
- Verify your OpenAI account has credits: platform.openai.com/account/billing
ChromaDB connection error
ChromaDB connection error
Problem: Vector database not initialized or corrupted.Solution:
- Delete existing database:
- Recreate embeddings:
FileNotFoundError: chunks_final.json
FileNotFoundError: chunks_final.json
Problem: Missing source data files.Solution:
Ensure you cloned the complete repository:If missing, re-clone the repository or check that Git LFS files downloaded correctly.
Python version compatibility issues
Python version compatibility issues
Problem: Using Python version below 3.8.Solution:
- Install Python 3.8+ from python.org
- Create virtual environment with correct version:
Rate limit errors from OpenAI API
Rate limit errors from OpenAI API
Problem: Exceeding OpenAI API rate limits.Solution:
- Tier 1 accounts have lower rate limits
- Wait a few minutes between evaluation runs
- Consider upgrading your OpenAI account tier
- For comprehensive evaluations, use
--debugflag to see detailed progress
Upgrading
To upgrade to the latest version:Uninstallation
To completely remove the project:Next steps
Quickstart Guide
Run your first evaluation in 5 minutes
RAG Architectures
Learn about the different RAG strategies
Evaluation Guide
Understanding RAGAS metrics and results
API Reference
Explore the Python API for custom workflows
Getting help
If you encounter issues not covered in this guide:- Check the GitHub Issues
- Review the README
- Open a new issue with:
- Your Python version (
python --version) - Full error message
- Steps to reproduce
- Your operating system
- Your Python version (
System requirements summary
| Component | Requirement | Notes |
|---|---|---|
| Python | 3.8+ | Tested on 3.8, 3.9, 3.10, 3.11 |
| RAM | 4GB minimum | 8GB+ recommended for large evaluations |
| Storage | 500MB | For embeddings and results |
| OpenAI API | Active account | With available credits |
| Internet | Required | For API calls |
Estimated costs: Running a single RAG evaluation with 10 questions typically costs $0.05-0.15 USD depending on the model used.
