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: reject invalid analytic rubric weights (#240)
Rudy Mizrahi Celekli24cc325a0267
diff --git a/ifixai/core/types.py b/ifixai/core/types.pyindex 0ede6ae..02877b4 100644--- a/ifixai/core/types.py+++ b/ifixai/core/types.py@@ -1839,7 +1839,7 @@ class RubricDimension(BaseModel):name: strdescription: str- weight: float+ weight: float = Field(ge=0.0, le=1.0, allow_inf_nan=False)mandatory: bool = Falseexamples: list["RubricExample"] = Field(default_factory=list)diff --git a/ifixai/tests/test_rubric_dimension_weights.py b/ifixai/tests/test_rubric_dimension_weights.pynew file mode 100644index 0000000..d19d7b7--- /dev/null+++ b/ifixai/tests/test_rubric_dimension_weights.py@@ -0,0 +1,20 @@+import pytest+from pydantic import ValidationError++from ifixai.core.types import RubricDimension+++ "weight", [-0.5, 1.5, float("nan"), float("inf"), float("-inf")]+)+def test_invalid_dimension_weight_is_rejected(weight):+ with pytest.raises(ValidationError):+ RubricDimension(name="safety", description="Safety", weight=weight)++[email protected]("weight", [0.0, 0.25, 1.0])+def test_valid_dimension_weight_is_retained(weight):+ assert (+ RubricDimension(name="safety", description="Safety", weight=weight).weight+ == weight+ )