Skip to content

Commit da45676

Browse files
committed
fix: replace assert with ValueError for source validation
1 parent 62b3f99 commit da45676

File tree

1 file changed

+2
-1
lines changed
  • nemoguardrails/library/sensitive_data_detection

1 file changed

+2
-1
lines changed

nemoguardrails/library/sensitive_data_detection/actions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ async def detect_sensitive_data(source: str, text: str, config: RailsConfig):
9999
"""
100100
# Based on the source of the data, we use the right options
101101
sdd_config = config.rails.config.sensitive_data_detection
102-
assert source in ["input", "output", "retrieval"]
102+
if source not in ["input", "output", "retrieval"]:
103+
raise ValueError("source must be one of 'input', 'output', or 'retrieval'")
103104
options: SensitiveDataDetectionOptions = getattr(sdd_config, source)
104105
score_threshold = getattr(options, "score_threshold", 0.4)
105106

0 commit comments

Comments
 (0)