Prompt guard library for composing multiple safety checks.
Project description
Prompt Guard
Composable prompt-safety guards as a lightweight Python library. It provides:
- TF‑IDF guard for fast lexical similarity against known phrases.
- RAG guard for embedding-based retrieval against a sentence corpus.
- LLM judge for a final model-based classification.
Quick start
from prompt_guard import GuardPipeline, PromptGuardConfig
cfg = PromptGuardConfig(
embed_model_name="mxbai-embed-large",
judge_model_name="qwen2.5:3b-instruct",
)
guard = GuardPipeline(cfg)
result = await guard.check("Some prompt")
Notes
- TF‑IDF and RAG build in‑memory indexes at first use.
- RAG and LLM judge use local Ollama models by default; ensure Ollama is running and the models are pulled.
Text file formats
phrases.txt: one phrase per line (blank lines are ignored).sentences.txt: one sentence per line (blank lines are ignored).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prompt_firewall-0.1.5.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prompt_firewall-0.1.5.tar.gz.
File metadata
- Download URL: prompt_firewall-0.1.5.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a55344a515e3d8fa99796f0f2de9e435137b3d9b1a24262c7768b8588338fcf2
|
|
| MD5 |
ea093cea2854878fdf9b1d589d2c6d17
|
|
| BLAKE2b-256 |
a007fa3ede2c4cef7c5144545f325b6e8b68ad030045aac182aed2770fbe19d9
|
File details
Details for the file prompt_firewall-0.1.5-py3-none-any.whl.
File metadata
- Download URL: prompt_firewall-0.1.5-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f532a12f46a19eaa67629dac500b4c5d23ed2b4704b611f9c7ec5bc864244098
|
|
| MD5 |
bb0268d009f1f71398848db1079cfbb9
|
|
| BLAKE2b-256 |
52abd99ed091f24ba40191aa89588840c91d67d81d3d02a41970c52150807fe0
|