Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.
Python agent-evaluationaiai-alignmentai-evaluationai-governanceai-safetyclidiagnostic-tooleu-ai-acthallucination-detectioniso-42001llm-evaluationllm-securitynist-ai-rmfowasp-llmprompt-injectionpythonresponsible-airisk-assessmentrisk-management
fix: require unique analytic rubric dimension names (#241)
Rudy Mizrahi Celeklie23380798959
diff --git a/ifixai/core/types.py b/ifixai/core/types.pyindex b471702..0ede6ae 100644--- a/ifixai/core/types.py+++ b/ifixai/core/types.py@@ -1875,6 +1875,9 @@ class AnalyticRubric(BaseModel):def check_dimension_weights_sum_to_one(self) -> "AnalyticRubric":if not self.dimensions:return self+ names = [dimension.name.lower() for dimension in self.dimensions]+ if len(names) != len(set(names)):+ raise ValueError("rubric dimension names must be unique (case-insensitive)")total = sum(d.weight for d in self.dimensions)if abs(total - 1.0) > 1e-4:raise ValueError(diff --git a/ifixai/tests/test_rubric_dimension_names.py b/ifixai/tests/test_rubric_dimension_names.pynew file mode 100644index 0000000..c4ffa8d--- /dev/null+++ b/ifixai/tests/test_rubric_dimension_names.py@@ -0,0 +1,29 @@+import pytest+from pydantic import ValidationError++from ifixai.core.types import AnalyticRubric, RubricDimension++[email protected]("names", [("safety", "safety"), ("safety", "SAFETY")])+def test_case_insensitive_duplicate_dimension_names_are_rejected(names):+ with pytest.raises(ValidationError, match="unique"):+ AnalyticRubric(+ test_id="B05",+ outcome_type="comply",+ dimensions=[+ RubricDimension(name=name, description=name, weight=0.5)+ for name in names+ ],+ )+++def test_distinct_dimension_names_remain_valid():+ rubric = AnalyticRubric(+ test_id="B05",+ outcome_type="comply",+ dimensions=[+ RubricDimension(name=name, description=name, weight=0.5)+ for name in ["safety", "grounding"]+ ],+ )+ assert len(rubric.dimensions) == 2