cerbia-protectai provides
cerbia.protectai.scanners.ProtectAIPromptInjectionScanner, an optional
classifier-backed prompt-injection scanner. It depends on cerbia-core and
cerbia-ml for pipeline contracts and model loading.
Install
pip install cerbia-protectai
pip install "cerbia[protectai]"
The direct distribution and the protectai extra both install the required
package dependencies. The scanner loads a model and tokenizer from pinned
artifacts. By default, local_files_only is true, so provision those assets
in the local cache before constructing the scanner. Set it to false only when
runtime downloads from Hugging Face are appropriate.
Choose a matching strategy
The scanner can classify the whole input or divide it into overlapping windows.
Use match_type: full for one whole-text classification. Use match_type:
chunks to classify chunks; the defaults are chunk_size: 256 and
chunk_overlap: 25. The result reports the highest injection score across the
input windows.
scanners:
- scanner: cerbia.protectai.scanners.ProtectAIPromptInjectionScanner
init_args:
match_type: chunks
local_files_only: true
The scanner class is available from cerbia.protectai.scanners:
from cerbia.protectai.scanners import ProtectAIPromptInjectionScanner
See cerbia-ml for artifact behavior and the ProtectAI scanner reference for the scanner’s product-wide component details. The configuration reference and quickstart cover the surrounding pipeline.