Metadata-Version: 2.4
Name: prompt-firewall
Version: 0.1.6
Summary: Prompt guard library for composing multiple safety checks.
Requires-Python: >=3.13
Description-Content-Type: text/markdown
Requires-Dist: llama-index>=0.14.13
Requires-Dist: llama-index-embeddings-ollama>=0.8.6
Requires-Dist: llama-index-llms-ollama>=0.9.1
Requires-Dist: scikit-learn>=1.8.0

# 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

```python
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).
