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.6.tar.gz
(5.8 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.6.tar.gz.
File metadata
- Download URL: prompt_firewall-0.1.6.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1d010de94c087f6f64763284d3eddfcd5fb9a12f3682b34ee1e9ef6394fe314
|
|
| MD5 |
d1f1cdb5e229e7d922f8b3d55f95ca1f
|
|
| BLAKE2b-256 |
428d76c93cb64aab49bb7b4246a58ec986b25e9253c827deecbf000f61a23d43
|
File details
Details for the file prompt_firewall-0.1.6-py3-none-any.whl.
File metadata
- Download URL: prompt_firewall-0.1.6-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 |
491a724b81996a9995e732dc661e6d8c78d526898b1b52ee6bd7fe206baa410d
|
|
| MD5 |
d4f515d48e68e22ef36cc7ac8a00fa38
|
|
| BLAKE2b-256 |
bc5aa7487975f7c4ff62b87ee28adce93959ec696eaad1b0d39b519bb4313a28
|