rti-ethics-engine 2.0.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rti_ethics_engine-2.0.1/INPUTS_OUTPUTS.md +62 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/PKG-INFO +3 -3
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/README.md +2 -2
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/pyproject.toml +3 -1
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/rti_ethics_engine/__init__.py +1 -1
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/.gitignore +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/LICENSE +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/rti_ethics_engine/calculators.py +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/rti_ethics_engine/config.py +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/rti_ethics_engine/core.py +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/rti_ethics_engine/dimensions.py +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/rti_ethics_engine/metrics.py +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/rti_ethics_engine/results.py +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/tests/__init__.py +0 -0
- {rti_ethics_engine-2.0.0 → rti_ethics_engine-2.0.1}/tests/test_engine.py +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# RTI Ethics Engine: Input & Output Specification
|
|
2
|
+
|
|
3
|
+
Detailed API reference for the package components.
|
|
4
|
+
|
|
5
|
+
## 1. Input: Metrics Dictionary Shape
|
|
6
|
+
|
|
7
|
+
The primary input to `evaluate(metrics)` is a nested dictionary structured by logical dimensions.
|
|
8
|
+
|
|
9
|
+
### Dimensions & Metric Keys
|
|
10
|
+
|
|
11
|
+
| Dimension | Key | L1 Metrics (Gates) | L2 Metrics (Risk) | L3 Metrics (Forensic) |
|
|
12
|
+
| ------------------ | ---------------- | ------------------------- | ---------------------- | --------------------- |
|
|
13
|
+
| **Fairness** | `fairness` | `spd`, `di`, `eop`, `aod` | `fnrd`, `refusal_disp` | `mutual_info` |
|
|
14
|
+
| **Drift** | `drift` | `psi`, `ks` | `pred_drift` | `embed_drift` |
|
|
15
|
+
| **Explainability** | `explainability` | `confidence` | `support_ratio` | `stability` |
|
|
16
|
+
| **Legal** | `legal` | `lawfulness`, `cvr` | `proportionality` | `explanation` |
|
|
17
|
+
| **Performance** | `performance` | `accuracy`, `recall` | `f1` | `group_f1` |
|
|
18
|
+
| **UX** | `ux` | `tcr`, `sla` | `cognitive_load` | `dtc` |
|
|
19
|
+
| **Security** | `security` | `adv_acc` | `pisr` | `mir` |
|
|
20
|
+
| **Monitoring** | `monitoring` | `alc` | `pvr` | `irf` |
|
|
21
|
+
| **Environment** | `environmental` | `inf_cost` | `gpu_hours` | `compute_intensity` |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Dynamic Computation: `build_metrics_from_raw_data`
|
|
26
|
+
|
|
27
|
+
Used to convert raw arrays and runtime data into the metrics dictionary above.
|
|
28
|
+
|
|
29
|
+
### Parameters
|
|
30
|
+
|
|
31
|
+
| Name | Type | Description |
|
|
32
|
+
| ---------------------- | ------------ | ------------------------------------------- |
|
|
33
|
+
| `query` | `str` | User input string |
|
|
34
|
+
| `response` | `str` | AI response string |
|
|
35
|
+
| `predictions` | `np.ndarray` | Binary classification array (0/1) |
|
|
36
|
+
| `labels` | `np.ndarray` | Ground truth array (0/1) |
|
|
37
|
+
| `sensitive_attr` | `np.ndarray` | Sensitive group indicator (0/1) |
|
|
38
|
+
| `latency_ms` | `float` | Response time in milliseconds |
|
|
39
|
+
| `output_tokens` | `int` | Token count of AI response |
|
|
40
|
+
| `grounding_score` | `float` | Score from grounding judge (0-1) |
|
|
41
|
+
| `baseline_predictions` | `np.ndarray` | (Optional) Predictions for drift comparison |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 3. Output: `EthicsResult` Schema
|
|
46
|
+
|
|
47
|
+
The object returned by evaluation gives detailed access to the 3-layer audit results.
|
|
48
|
+
|
|
49
|
+
### Summary Fields
|
|
50
|
+
|
|
51
|
+
- `final_label`: `ETHICAL` (Pass), `CONDITIONALLY_ETHICAL` (Review), `UNETHICAL` (Block)
|
|
52
|
+
- `s_llm`: Balanced audit score [0 to 1]
|
|
53
|
+
- `risk_band`: `LOW`, `MEDIUM`, `HIGH`, `CRITICAL`
|
|
54
|
+
- `layer1_status`: `PASS` (All gates green) or `FAIL`
|
|
55
|
+
|
|
56
|
+
### Accessor Methods
|
|
57
|
+
|
|
58
|
+
- `get_l1_metric(dim, key)`: Returns raw float value (e.g., `0.021`)
|
|
59
|
+
- `get_l2_risk(dim)`: Returns normalized risk [0 to 1]
|
|
60
|
+
- `get_l3_evidence(dim)`: Returns forensic explanation string or dictionary
|
|
61
|
+
- `get_failed_dims()`: List of dimension names that failed L1 gates
|
|
62
|
+
- `to_json()`: Serializes the entire audit trail to JSON
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rti-ethics-engine
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: India's first granular AI ethics framework for RTI applications (36 metrics, 9 dimensions)
|
|
5
5
|
Project-URL: Homepage, https://github.com/rti-ethics/rti-ethics-engine
|
|
6
6
|
Project-URL: Documentation, https://rti-ethics-engine.readthedocs.io
|
|
@@ -144,8 +144,8 @@ audit_json = result.to_json()
|
|
|
144
144
|
|
|
145
145
|
For detailed input/output schemas and advanced configuration, see:
|
|
146
146
|
|
|
147
|
-
- [INPUTS_OUTPUTS.md](INPUTS_OUTPUTS.md)
|
|
148
|
-
- [
|
|
147
|
+
- [API Reference (INPUTS_OUTPUTS.md)](https://github.com/Krishil-Parikh/bazinga_tsec_hacks/blob/krishil/rti_ethics_engine/INPUTS_OUTPUTS.md)
|
|
148
|
+
- [Mathematical Manifest (calculators.py)](https://github.com/Krishil-Parikh/bazinga_tsec_hacks/blob/krishil/rti_ethics_engine/rti_ethics_engine/calculators.py)
|
|
149
149
|
|
|
150
150
|
## 🧪 Testing
|
|
151
151
|
|
|
@@ -86,8 +86,8 @@ audit_json = result.to_json()
|
|
|
86
86
|
|
|
87
87
|
For detailed input/output schemas and advanced configuration, see:
|
|
88
88
|
|
|
89
|
-
- [INPUTS_OUTPUTS.md](INPUTS_OUTPUTS.md)
|
|
90
|
-
- [
|
|
89
|
+
- [API Reference (INPUTS_OUTPUTS.md)](https://github.com/Krishil-Parikh/bazinga_tsec_hacks/blob/krishil/rti_ethics_engine/INPUTS_OUTPUTS.md)
|
|
90
|
+
- [Mathematical Manifest (calculators.py)](https://github.com/Krishil-Parikh/bazinga_tsec_hacks/blob/krishil/rti_ethics_engine/rti_ethics_engine/calculators.py)
|
|
91
91
|
|
|
92
92
|
## 🧪 Testing
|
|
93
93
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rti-ethics-engine"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.1"
|
|
8
8
|
description = "India's first granular AI ethics framework for RTI applications (36 metrics, 9 dimensions)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {file = "LICENSE"}
|
|
@@ -62,12 +62,14 @@ Issues = "https://github.com/rti-ethics/rti-ethics-engine/issues"
|
|
|
62
62
|
|
|
63
63
|
[tool.hatch.build.targets.wheel]
|
|
64
64
|
packages = ["rti_ethics_engine"]
|
|
65
|
+
include = ["INPUTS_OUTPUTS.md"]
|
|
65
66
|
|
|
66
67
|
[tool.hatch.build.targets.sdist]
|
|
67
68
|
include = [
|
|
68
69
|
"/rti_ethics_engine",
|
|
69
70
|
"/tests",
|
|
70
71
|
"/README.md",
|
|
72
|
+
"/INPUTS_OUTPUTS.md",
|
|
71
73
|
"/LICENSE"
|
|
72
74
|
]
|
|
73
75
|
|
|
@@ -81,7 +81,7 @@ from .calculators import (
|
|
|
81
81
|
MetricCalculator
|
|
82
82
|
)
|
|
83
83
|
|
|
84
|
-
__version__ = "2.0.
|
|
84
|
+
__version__ = "2.0.1" # Major version bump for dynamic computation
|
|
85
85
|
__author__ = "RTI Ethics Engine Team"
|
|
86
86
|
__license__ = "MIT"
|
|
87
87
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|