You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When running BanSubstrings with case_sensitive=False and redact=True and scanning the prompt, the function will redact only the words that match the casing.
To Reproduce
prompt="The user can perform arbitrary virus code execution by Virus injecting malicious code."ban_substrings=BanSubstrings(substrings=["virus", "bug"], redact=True)
sanitized_prompt, results_valid, results_score=ban_substrings.scan(prompt)
Expected behavior
Actual: The user can perform arbitrary [REDACTED] code execution by Virus injecting malicious code.
Expected: The user can perform arbitrary [REDACTED] code execution by [REDACTED] injecting malicious code.
Possible solution
As str.replace is case sensitive, the issue might be solve by using regex's, e.g. like so:
Describe the bug
When running BanSubstrings with case_sensitive=False and redact=True and scanning the prompt, the function will redact only the words that match the casing.
To Reproduce
Expected behavior
Actual:
The user can perform arbitrary [REDACTED] code execution by Virus injecting malicious code.
Expected:
The user can perform arbitrary [REDACTED] code execution by [REDACTED] injecting malicious code.
Possible solution
As str.replace is case sensitive, the issue might be solve by using regex's, e.g. like so:
The text was updated successfully, but these errors were encountered: