Skip to content

Stop input Substrings

The StopInputSubstring detector checks and filters out banned substrings from input text prompt.

Vulnerability

Usage

Default dictionary includes common malware requests, eicar_signature, gtube_signature, gtphish_signature and more.

Configuration

from pegasi.shield.input_detectors import StopInputSubstrings

substrings = ["Project Apollo", "Project Chiron", "Patent #3728", "Apollo", "Chiron", "Jailbreak"]
pegasi = Shield()
input_detectors = [StopInputSubstrings(substrings=substrings)]

sanitized_prompt, valid_results, risk_score = pegasi.scan_input(prompt, input_detectors)

Here's what the option is for:

  • substrings (List[str]): user-provided substrings in addition to default patterns.
  • `case_sensitive``: bool = False,