Repository navigation
Veil 0.1.0
First public release of Veil, a privacy-preserving proxy for LLMs. It detects personal data in text, replaces it with tokens ([PERSON_1]) or fake values, sends the anonymized text to the model, and restores the originals in the reply.
You: "My SSN is 123-45-6789, help with taxes"
LLM sees: "My SSN is [SSN_1], help with taxes"
You see: "For your SSN 123-45-6789, I recommend..."
Install
pip install "git+https://github.com/SpinettaInc/veil.git@v0.1.0"
python -m spacy download en_core_web_smPython 3.10 or newer. Optional extras: faker, rarity, desktop, full.
What's in it
- Detection: spaCy NER plus validated regex patterns (e-mail, phone, SSN, credit cards, IBAN, IPv4/IPv6, medical record numbers, dates, addresses), with optional Presidio in hybrid mode. Loose patterns need a cue word nearby.
- Profiles:
paranoid,balancedandminimal, defined in YAML. Custom profiles can change weights and add their own regex detectors and token labels. - Replacement modes:
token,fakerandsemantic. One person keeps one token across spellings, titles and partial names. - Reconstruction tolerates tokens the model rewrote (
EMAIL_1,[email 1],<Email_1>). - LLM proxy (
VeilProxy) for OpenAI, Anthropic and Ollama: keeps the anonymized conversation itself, anonymizes the system prompt and any supplied history, and streams already-reconstructed text. - Fail closed: if a requested detector cannot load, Veil raises instead of anonymizing less. Misspelt profiles and modes are errors too.
- CLI:
veil anonymize,detect,score,reconstruct,stats,serve,app. - HTTP API (
veil serve) with per-session mappings, a JSONL audit log that records counts and timings only, and batch anonymization. - Desktop app (Gradio) and a Guardrails AI validator.
Quality
CI runs lint, the test suite, a labeled precision benchmark in both detection modes with a minimum F1 of 0.95, and a randomised round-trip fuzz. On the benchmark corpus F1 is 0.96 with en_core_web_sm (0.97 in hybrid mode) and 1.00 with en_core_web_lg.
Good to know
- Only
tokenmode round-trips unambiguously; prefer it for proxy use. - The API server has no built-in authentication and binds to
127.0.0.1by default. - Detection is English-only for now.
- This is an alpha (0.x): the Python API may still change.
Licensed under the GNU General Public License v3.0. Full details are in the changelog and the docs.