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.
🚀 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:
- Layer 1: Hard Gates (L1) - Pass/Fail compliance checks (e.g., Statistical Parity < 0.1).
- Layer 2: Risk Scoring (L2) - Normalized risk vectors weighted by policy importance.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rti_ethics_engine-2.0.1.tar.gz.
File metadata
- Download URL: rti_ethics_engine-2.0.1.tar.gz
- Upload date:
- Size: 34.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcbf09aeec150f514a9eb783f94380d55a5a1cc64b8a67023260b196098101ab
|
|
| MD5 |
fccd92235a8c44e4ba3e8f984b591d3a
|
|
| BLAKE2b-256 |
e8471b30243706173b5e875b8e8491b33eff325d33beadbb3e56db8211641eb2
|
File details
Details for the file rti_ethics_engine-2.0.1-py3-none-any.whl.
File metadata
- Download URL: rti_ethics_engine-2.0.1-py3-none-any.whl
- Upload date:
- Size: 34.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2116849a8e32c5c6f8932dc57ba6cdce6a178768338471b58443a1e50b58b8fd
|
|
| MD5 |
6ddae004df641741de05990047ce48dd
|
|
| BLAKE2b-256 |
11f63b89d2c7c5af46ff5053033d72572dbe672eb56e86b321bf414fcdefdc00
|