Skip to main content

India's first granular AI ethics framework for RTI applications (36 metrics, 9 dimensions)

Project description

RTI Ethics Engine (v2.0.0)

India's first granular AI ethics framework for RTI applications - A production-ready Python package implementing 36 metrics across 9 ethical dimensions with granular formula access and dynamic data computation.

Python 3.9+ License: MIT


🚀 Installation

pip install rti-ethics-engine

⚡ Quick Start (Dynamic Mode)

The recommended way to use the engine is to compute metrics directly from your application data:

import numpy as np
from rti_ethics_engine import evaluate_from_raw

# 1. Prepare your data
query = "What is the budget for the Metro project?"
response = "The budget for the Metro project is 5000 Crores..."
predictions = np.array([1, 1, 0, 1])  # Model predictions
labels = np.array([1, 1, 1, 1])       # Ground truth
sensitive_attr = np.array([0, 1, 0, 1]) # Demographic group (e.g. Urban/Rural)

# 2. Evaluate with one call
result = evaluate_from_raw(
    query=query,
    response=response,
    predictions=predictions,
    labels=labels,
    sensitive_attr=sensitive_attr,
    latency_ms=450.0,
    grounding_score=0.92
)

# 3. Get results
print(f"Label: {result.final_label}")  # "ETHICAL"
print(f"S_LLM Score: {result.s_llm}")  # 0.942
print(f"Risk Band: {result.risk_band}") # "LOW"

📊 The 3-Layer Audit Protocol

The RTI Ethics Engine uses a rigorous 3-layer protocol for every dimension:

  1. Layer 1: Hard Gates (L1) - Pass/Fail compliance checks (e.g., Statistical Parity < 0.1).
  2. Layer 2: Risk Scoring (L2) - Normalized risk vectors weighted by policy importance.
  3. Layer 3: Forensic Evidence (L3) - Detailed context and reasoning for the scores.

Granular Access

# Check if a specific dimension passed its hard gates
if result.get_l1_status("fairness") == "FAIL":
    print(f"Fairness fail reasons: {result.get_l1_reasons('fairness')}")

# Get granular metric values (36 metrics available)
spd = result.get_l1_metric("fairness", "spd")
psi = result.get_l1_metric("drift", "psi")

# Export complete audit trail
audit_json = result.to_json()

🏗️ 9 Ethical Dimensions

Dimension Description Key Metrics
Legal Compliance RTI Act 2005 & Data Policy alignment Lawfulness, Consent Validity
Bias & Fairness Demographic equity across groups SPD, DI, EOP, AOD
Explainability Transparency & Model Confidence FI Sum, Counterfactual Distance
Security Robustness against prompt injection PISR, Adversarial Accuracy
Monitoring Audit trail & SLA integrity Audit Completeness, SLA rate
Performance Statistical accuracy of responses Recall, Group-F1, Accuracy
Human-AI UX User friction and frustration levels TCR, Cognitive Load
Drift Model/Data stability over time PSI, KS-Statistic
Environment Carbon footprint & compute cost GPU Hours, Inference Cost

📖 Documentation

For detailed input/output schemas and advanced configuration, see:

🧪 Testing

pytest tests/ -v

🇮🇳 Why RTI Ethics Engine?

Designed specifically for Right to Information (RTI) workflows, it ensures that AI systems responding to citizen queries are:

  • Legally Sound: Compliant with Section 4/8 of the RTI Act.
  • Fair: No bias between rural/urban or language variations.
  • Auditable: Providing forensic evidence for Central Information Commission (CIC) audits.

License: MIT | Support: github.com/rti-ethics/rti-ethics-engine

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

rti_ethics_engine-2.0.0.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

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

rti_ethics_engine-2.0.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file rti_ethics_engine-2.0.0.tar.gz.

File metadata

  • Download URL: rti_ethics_engine-2.0.0.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for rti_ethics_engine-2.0.0.tar.gz
Algorithm Hash digest
SHA256 b4d8ddb408fb409921fbde764af609aa6587929c7f47a99ab23a4b78eff5722f
MD5 926398bf352da604b47cb8186230abfe
BLAKE2b-256 650fe727542bd6ea7690c2bcca0e4455db710f10407f54bb329616ebe5c2602a

See more details on using hashes here.

File details

Details for the file rti_ethics_engine-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rti_ethics_engine-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bd057777cb52278e40f4320ebf7463033a107c50ffdc12a71b3855729fb4ec1
MD5 c40ab0d87beb6bb40e51d19ab593b1de
BLAKE2b-256 208030d7965210537e1007d12a2258667c08eb3b84d0061ddcd488a7b709340f

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