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.6.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.6-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rag_sentinel-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 9423a28213ee09679be708b8ecbb7a097f8efa89d963b508510d2e2c66006282
MD5 78fbbdd694a33ef689756ca904544b5f
BLAKE2b-256 c4dc87b1bf039f05809486dbfe822beb038daf5222dfa31a129cfbfa04c9031f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rag_sentinel-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 13.6 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 30fa12d31c7571124b056f909afe891fe51845e70ce7cecfadb737748fab7d5d
MD5 6dd9791e6805a527a9f844754ea10ed4
BLAKE2b-256 b56be50288017bf79413345b27c7ce1f6b9cc3957742666f785c9e4465d68ae1

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