Skip to main content

RAG Evaluation Framework using Ragas metrics and MLflow tracking

Project description

RAGSentinel

RAG Evaluation Framework using Ragas metrics and MLflow tracking.

Installation

1. Create Virtual Environment

# Create project directory
mkdir my-rag-eval
cd my-rag-eval

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

2. Install Package

pip install rag-sentinel

Quick Start

1. Initialize Project

rag-sentinel init

This creates:

  • .env - LLM/Embeddings API keys
  • config.ini - App settings and authentication
  • rag_eval_config.yaml - Master configuration
  • test_dataset.csv - Sample test dataset

2. Configure

Edit .env:

AZURE_OPENAI_API_KEY=your-api-key
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_VERSION=2024-02-15-preview
AZURE_OPENAI_CHAT_DEPLOYMENT=gpt-4
AZURE_OPENAI_EMBEDDING_DEPLOYMENT=text-embedding-ada-002

Edit config.ini:

[app]
app_url = https://your-rag-app.com/backend

[endpoints]
context_api_path = /api/retrieve_context
answer_api_path = /api/respond

[auth]
type = cookie
cookie_name = session
cookie_value = your-session-cookie

[mlflow]
tracking_uri = http://127.0.0.1:5001

3. Edit Test Dataset

Edit test_dataset.csv:

chat_id,query,ground_truth
1,What is RAG?,RAG stands for Retrieval-Augmented Generation
2,How does it work?,RAG combines retrieval and generation

4. Validate & Run

# Validate configuration
rag-sentinel validate

# Run evaluation
rag-sentinel run

Results will be available in the MLflow UI at the configured tracking URI.

CLI Commands

# Initialize new project
rag-sentinel init

# Validate configuration
rag-sentinel validate

# Run evaluation (auto-starts MLflow)
rag-sentinel run

# Run without starting MLflow server
rag-sentinel run --no-server

# Overwrite existing config files
rag-sentinel init --force

# Check package version
pip show rag-sentinel

# Upgrade to latest version
pip install --upgrade rag-sentinel

Metrics

  • Faithfulness - Factual consistency of answer with context
  • Answer Relevancy - How relevant the answer is to the question
  • Context Precision - Quality of retrieved context
  • Answer Correctness - Comparison against ground truth

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rag_sentinel-0.1.5.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rag_sentinel-0.1.5-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file rag_sentinel-0.1.5.tar.gz.

File metadata

  • Download URL: rag_sentinel-0.1.5.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for rag_sentinel-0.1.5.tar.gz
Algorithm Hash digest
SHA256 117a8e239ff7f89a49f83e827b122ecee869521ddda9cc3e3c3a53c676a38b72
MD5 5c3e5eea01e5d99ebd97397cb6051738
BLAKE2b-256 f681682de3252c4c8f7999c01e55f24171d2c49c10b8a75292bd2e443ec0db9c

See more details on using hashes here.

File details

Details for the file rag_sentinel-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: rag_sentinel-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for rag_sentinel-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2be8dd9b4646c08d29ce944722f53bb2b892da9951e225d66a2a72d3f9f0f8e4
MD5 462c566be63ea0749f23dfad96f5e3e1
BLAKE2b-256 ee38e9ac54f590616757143b42f3a2530e4706e8ddee36c531b76b4109838914

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page