Content safety
Remove personal data before it reaches a model, and check what goes in and comes out.
Redaction: personal data stays out
A route can remove personal data from what it sends, so the model never sees it:
[ai.tasks.chat]
safety = { redact = ["email", "phone", "card"], restore = true }| Kind | What is found |
|---|---|
email, phone | e-mail addresses and phone numbers |
card | payment card numbers |
national-id | identity numbers in common national formats |
address | street addresses |
patterns | your own, as regular expressions |
The model sees [email-1], [phone-1]. With restore: true, the gateway puts the originals back in the answer before your app gets it.
Moderation: check what goes in and comes out
safety:
moderation: input # off | input | bothThe gateway checks the text for violence, hate, sexual content, self-harm, harassment and illegal requests. What is blocked answers 422 content_blocked, with the stage (input or output) and the categories, so your app can show its own message. Each check is a small call, counted in usage like any other.
Both are off by default. For a task that browsers may call, turn on at least moderation: input.
To check a text on its own, without asking a model anything: POST /v1/moderations.