Skip to content

Install

The distribution name and the import name are different.

pip install ferroguard
import llm_guardrails
from llm_guardrails import GuardrailsPipeline

import ferroguard does not load the library. Wheels are abi3 for Python 3.11 and newer, so one wheel covers 3.11 through 3.14.

from llm_guardrails import GuardrailsPipeline

pipeline = GuardrailsPipeline()
pre = pipeline.pre_process("Mail a@b.co about the notes.")
print(pre.sanitised_text)
print("blocked", pre.blocked)

pre.sanitised_text for that input is Mail <<EMAIL_1>> about the notes. pre.blocked is false. pre.pii_mapping maps <<EMAIL_1>> back to a@b.co. Keep that mapping in your process. The HTTP demo does not return it.

Restore and the output checks:

from llm_guardrails import GuardrailsPipeline

pipeline = GuardrailsPipeline()
pre = pipeline.pre_process("Mail a@b.co about the notes.")
post = pipeline.post_process("Noted.", pre.pii_mapping)
print(post.final_text)
print(post.validation.is_valid)
print(post.bias.score)

That prints Noted., then True, then 0.0.

Development from a checkout uses uv and builds the extension:

uv sync --locked --all-extras

Publishing a wheel is the release workflow on main. This site does not publish packages.