-
Notifications
You must be signed in to change notification settings - Fork 0
fix: fail guardrail validation only when all rules are violated #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f34cb78 to
f9496a3
Compare
| if violation_detected: | ||
| operator = ( | ||
| _humanize_guardrail_func(rule.detects_violation) or "violation check" | ||
| if not violation_detected: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If any of the fields don't violate the guardrail condition, then the validation should pass
| return True, reason | ||
|
|
||
| return True, "All word rule validations passed" | ||
| return False, get_validated_conditions_description( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only when all fields violate the guardrail condition, then the validation should fail
|
|
||
| if not passed: | ||
| validated_conditions.append(reason) | ||
| if passed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If any of the rules is not violated, then the validation should pass
| return GuardrailValidationResult( | ||
| result=GuardrailValidationResultType.PASSED, | ||
| reason="All deterministic guardrail rules passed", | ||
| result=GuardrailValidationResultType.VALIDATION_FAILED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only when all rules are violated, then the validation should fail
2542fe5 to
cc9197f
Compare
d4ef5b6 to
ef04db0
Compare
ef04db0 to
711efc0
Compare
Apply multiple fixes regarding deterministic guardrails evaluation: