experimental[minor]: upgrade the prompt injection model (#20783)

- **Description:** In January, Laiyer.ai became part of ProtectAI, which
means the model became owned by ProtectAI. In addition to that,
yesterday, we released a new version of the model addressing issues the
Langchain's community and others mentioned to us about false-positives.
The new model has a better accuracy compared to the previous version,
and we thought the Langchain community would benefit from using the
[latest version of the
model](https://huggingface.co/protectai/deberta-v3-base-prompt-injection-v2).
- **Issue:** N/A
- **Dependencies:** N/A
- **Twitter handle:** @alex_yaremchuk
This commit is contained in:
Oleksandr Yaremchuk
2024-04-23 16:23:39 +02:00
committed by GitHub
parent 645b1e142e
commit 9428923bab
3 changed files with 13 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ class PromptInjectionException(ValueError):
def _model_default_factory(
model_name: str = "laiyer/deberta-v3-base-prompt-injection",
model_name: str = "protectai/deberta-v3-base-prompt-injection-v2",
) -> Pipeline:
try:
from transformers import (
@@ -64,7 +64,7 @@ class HuggingFaceInjectionIdentifier(BaseTool):
Can be specified as transformers Pipeline or string. String should correspond to the
model name of a text-classification transformers model. Defaults to
``laiyer/deberta-v3-base-prompt-injection`` model.
``protectai/deberta-v3-base-prompt-injection-v2`` model.
"""
threshold: float = Field(
description="Threshold for prompt injection detection.", default=0.5