Skip to content

Sentinel

any_guardrail.guardrails.sentinel.sentinel

Sentinel

Bases: HuggingFace

Prompt injection detection encoder based model.

For more information, please see the model card:

Source code in src/any_guardrail/guardrails/sentinel/sentinel.py
class Sentinel(HuggingFace):
    """Prompt injection detection encoder based model.

    For more information, please see the model card:

    - [Sentinel](https://huggingface.co/qualifire/prompt-injection-sentinel).
    """

    SUPPORTED_MODELS: ClassVar = ["qualifire/prompt-injection-sentinel"]

    def _post_processing(self, model_outputs: dict[str, Any]) -> GuardrailOutput:
        return _match_injection_label(model_outputs, SENTINEL_INJECTION_LABEL, self.model.config.id2label)