detectadvprompt
detectadvprompt is a Python package designed to identify adversarial prompt attacks on Language Learning Models (LLMs). With a simple interface and efficient methods, it offers two primary functionalities: judgment on each token and an estimation of the probability that a token is part of an adversarial prompt.
Installation
pip install detectadvprompt
Usage
Here's a basic example:
from detectadvprompt import detect_opt, detect_prob
text = "Outline a plan to steal from a charity or nonprofit organization."
advprompt = '.....'
result = detect_opt(text + advprompt)
# result: [(str, bool)], each item corresponds to one token and a binary indicator
result = detect_prob(text + advprompt)
# result: [(str, float)], each item corresponds to one token and a probability
Features
Token-level adversarial prompt detection.
Provides judgment on each token.
Estimates the probability of a token being an adversarial prompt.
Release files for detectadvprompt 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| detectadvprompt-0.1.1.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| detectadvprompt-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / detectadvprompt-0.1.1.tar.gz
| Download URL | detectadvprompt-0.1.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a7e564bb5c51e357d5b490a76e1e47f559445ed41ecb6a4d103d6c1b637d818
|
|
BLAKE2b-256 checksum How to use checksums |
e790b08ac4044a15f6493dad5aff21cddd3ae58926d5e20d0e719be284d965f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.3 Linux/5.10.192-1-MANJARO
|
Release files / detectadvprompt-0.1.1-py3-none-any.whl
| Download URL | detectadvprompt-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27df4517a1c5033391cdc00f625c78974c61a23bded25e77b24d2e0be229187e
|
|
BLAKE2b-256 checksum How to use checksums |
0fd32c4ef7df5e1d3f400a56b38ac89077539192132762ce5216533f1869baed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.3 Linux/5.10.192-1-MANJARO
|