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).
Metadata
Release files for prompt-firewall 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prompt_firewall-0.1.6.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prompt_firewall-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / prompt_firewall-0.1.6.tar.gz
| Download URL | prompt_firewall-0.1.6.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1d010de94c087f6f64763284d3eddfcd5fb9a12f3682b34ee1e9ef6394fe314
|
|
BLAKE2b-256 checksum How to use checksums |
428d76c93cb64aab49bb7b4246a58ec986b25e9253c827deecbf000f61a23d43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|
Release files / prompt_firewall-0.1.6-py3-none-any.whl
| Download URL | prompt_firewall-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
491a724b81996a9995e732dc661e6d8c78d526898b1b52ee6bd7fe206baa410d
|
|
BLAKE2b-256 checksum How to use checksums |
bc5aa7487975f7c4ff62b87ee28adce93959ec696eaad1b0d39b519bb4313a28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|