llmfy-guardrails is a standalone text-based PII detector/masker (PIIGuard, PIIType, PIIStrategy, PIIDetection/PIIDetectionResult). It has no dependency on llmfy or any other LLM framework — drop it into any Python pipeline that needs to detect or mask PII in plain text.
How to install
# Using UV
uv add llmfy-guardrails
# Using pip
pip install llmfy-guardrails
Installing llmfy-guardrails pulls in pydantic automatically — nothing else.
PII Guard — PERSON_NAME / ADDRESS detection
Most PIITypes are regex-based and work with no extra install. PIIType.PERSON_NAME/PIIType.ADDRESS are the exception — they're backed by an optional spaCy NER model, loaded lazily on first use:
# Using UV
uv add "llmfy-guardrails[spacy]"
uv add https://github.com/irufano/spacy_ner_pii/releases/download/v0.1.0/xx_ent_pii_sm-0.1.0-py3-none-any.whl
# Using pip
pip install "llmfy-guardrails[spacy]"
pip install https://github.com/irufano/spacy_ner_pii/releases/download/v0.1.0/xx_ent_pii_sm-0.1.0-py3-none-any.whl
xx_ent_pii_sm isn't published to PyPI, so it can't be pulled in as a normal extra — install it manually from the release wheel above.
Note that PIIGuard() defaults to detecting every PIIType, including these two — pass exclude_types=[PIIType.PERSON_NAME, PIIType.ADDRESS] if you don't want this dependency.
How to use
from llmfy_guardrails import PIIGuard, PIIStrategy, PIIType
guard = PIIGuard(exclude_types=[PIIType.PERSON_NAME, PIIType.ADDRESS]) # strategy=TOKENIZE (default)
result = guard.detect("Contact john.doe@example.com or call (555) 123-4567.")
print(result.processed_text) # "Contact [EMAIL_1] or call [PHONE_NUMBER_1]."
restored = guard.restore(result.processed_text, result.detections)
print(restored) # "Contact john.doe@example.com or call (555) 123-4567."
See llmfy_guardrails/example/pii_example.py for a full walkthrough of every strategy (TOKENIZE, MASK, REDACT, PARTIAL), custom types, and the NER-backed types.
Contributing
See CONTRIBUTING.md for commit message format, the automatic version-bump/release process, and local package development commands.
Metadata
Release files for llmfy-guardrails 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llmfy_guardrails-0.1.1.tar.gz | 13.4 kB | Without provenance | Details for llmfy_guardrails-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llmfy_guardrails-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for llmfy_guardrails-0.1.1-py3-none-any.whl |
Total release size: 30.9 kB
Release files / llmfy_guardrails-0.1.1.tar.gz
| Download URL | llmfy_guardrails-0.1.1.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fab951eca3e8df352cdc676052061f4b04804517496f4c1646f00a67c15b267
|
|
BLAKE2b-256 checksum How to use checksums |
8e7ee259fc0cce64a7636ae485a4f0b6e1e2df0ca7d6da19ec150acb77aa7f7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llmfy_guardrails-0.1.1-py3-none-any.whl
| Download URL | llmfy_guardrails-0.1.1-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7366d21cc499b8607e4e1e0dd4a03486a90a8087c43544d609d24b06d1ac3842
|
|
BLAKE2b-256 checksum How to use checksums |
6ef0dbc35afc4e4089d2bbd7622021b45185375cdf4870a48721c81e754216be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llmfy-guardrails 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.