India's first granular AI ethics framework for RTI applications (36 metrics, 9 dimensions)
Project description
RTI Ethics Engine
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.
🚀 Installation
pip install rti-ethics-engine
Or install from source:
git clone https://github.com/rti-ethics/rti-ethics-engine.git
cd rti-ethics-engine
pip install -e .
⚡ Quick Start
from rti_ethics_engine import evaluate
# Define your metrics
metrics = {
"fairness": {"spd": 0.02, "di": 1.0, "eop": 0.05, "aod": 0.03},
"drift": {"psi": 0.1, "ks": 0.02},
"legal": {"lawfulness": 1.0, "cvr": 0.98},
"performance": {"accuracy": 0.92, "recall": 0.88},
"explainability": {"confidence": 0.85, "fi": 0.3},
"security": {"adv_acc": 0.8, "pisr": 0.02},
"monitoring": {"alc": 0.98, "sla": 0.995},
"ux": {"tcr": 0.92, "ftr": 0.08},
"environmental": {"inf_cost": 0.02, "gpu_hours": 0.05}
}
# Evaluate
result = evaluate(metrics)
# Get the decision
print(result.final_label) # "ETHICAL"
print(result.s_llm) # 0.9234 (LLM Ethics Score)
print(result.risk_band) # "LOW"
🎯 Granular Metric Access
The killer feature - access ANY formula value at ANY layer:
# Access specific L1 formula values
spd = result.get_l1_metric("fairness", "spd") # 0.02
psi = result.get_l1_metric("drift", "psi") # 0.1
accuracy = result.get_l1_metric("performance", "accuracy") # 0.92
# Access L2 risk scores
fairness_risk = result.get_l2_risk("fairness") # 0.12
legal_risk = result.get_l2_risk("legal") # 0.00
# Access L3 forensic evidence
explanation = result.get_l3_evidence("legal")["explanation"]
# Aggregation helpers
failed_dims = result.get_failed_dims() # ["Legal Compliance"]
pass_rate = result.l1_pass_rate() # 0.889 (8/9 passed)
# Audit table for CIC compliance
result.print_audit_table()
# RTI-2026035174555 | ETHICAL | S_LLM=0.92
# ✅ Legal Compliance: L2=0.02
# ✅ Bias & Fairness: L2=0.05
# ...
📊 9 Ethical Dimensions
| Dimension | L1 Metrics | Description |
|---|---|---|
| Legal Compliance | lawfulness, cvr | RTI Act 2005 alignment |
| Bias & Fairness | spd, di, eop, aod | Demographic equity |
| Explainability | confidence, fi | Model interpretability |
| Security | adv_acc, pisr | Adversarial robustness |
| Monitoring | alc, sla | Audit trail integrity |
| Performance | accuracy, recall | Statistical accuracy |
| Human-AI UX | tcr, ftr | User friction |
| Drift | psi, ks | Model stability |
| Environmental | inf_cost, gpu_hours | Carbon footprint |
🏗️ Architecture
rti_ethics_engine/
├── __init__.py # Public API
├── config.py # Thresholds & weights
├── dimensions.py # 9 dimension evaluators
├── core.py # EthicsEngine orchestrator
├── results.py # EthicsResult with accessors
└── metrics.py # Computation helpers
📖 API Reference
evaluate(metrics: dict) -> EthicsResult
Quick evaluation entrypoint.
EthicsEngine
Full engine with run_protocol() method.
EthicsResult
Result object with:
final_label: "ETHICAL" / "CONDITIONALLY_ETHICAL" / "UNETHICAL"s_llm: LLM Ethics Score [0, 1]risk_band: "LOW" / "MEDIUM" / "HIGH" / "CRITICAL"get_l1_metric(dim, metric): Access any L1 formula valueget_l2_risk(dim): Get dimension risk scoreget_l3_evidence(dim): Get forensic evidenceget_failed_dims(): List failed dimensionsl1_pass_rate(): Fraction of L1 passesto_json(): Export as JSON
🧪 Testing
pip install -e ".[dev]"
pytest tests/ -v
📄 License
MIT License - See LICENSE for details.
🇮🇳 Made for India
Designed specifically for RTI Act 2005 compliance and CIC audit requirements.
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-1.0.0.tar.gz.
File metadata
- Download URL: rti_ethics_engine-1.0.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d60a47f8406084cf5e233416240b2d77138c65115ad1a1756bc7c191b136e7d7
|
|
| MD5 |
1aca4aefe15054a53695452957fe4945
|
|
| BLAKE2b-256 |
71b2fd610774d719a77251ad993fda3ddfe6533924e6e30fd56e4f3d5a960f14
|
File details
Details for the file rti_ethics_engine-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rti_ethics_engine-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.3 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 |
30f0bd6c7e6e69212ed50d6bda5e6ec9e246995f44833857bc023fd0f0fbf919
|
|
| MD5 |
eae6dc3c20a923b3bdaedaa291c5d9f0
|
|
| BLAKE2b-256 |
5a3df3afaa520c39fc496393236d77ac8f5b5b32fcca29f2b3885eb0a6d3438b
|