Skip to content
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

Disable streaming for forbidden onfail actions #928

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions guardrails/validator_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,23 @@ def run_validators(
# Validate the field
validators = validator_map.get(reference_property_path, [])
for validator in validators:
if stream:
if validator.on_fail_descriptor is OnFailAction.REASK:
raise ValueError("Reask is not supported for stream validation")
if validator.on_fail_descriptor is OnFailAction.FIX:
raise ValueError(
"Fix on fail is not supported for stream validation"
zsimjee marked this conversation as resolved.
Show resolved Hide resolved
)
if validator.on_fail_descriptor is OnFailAction.FIX_REASK:
raise ValueError("Fix Reask is not supported for stream validation")
if validator.on_fail_descriptor is OnFailAction.FILTER:
raise ValueError(
"Filter on fail is not supported for stream validation"
)
if validator.on_fail_descriptor is OnFailAction.REFRAIN:
raise ValueError(
"Refrain on fail is not supported for stream validation"
)
validator_logs = self.run_validator(
iteration,
validator,
Expand Down
Loading