Skip to content

Content safety

Remove personal data before it reaches a model, and check what goes in and comes out.

Applies to EngineCloud
View as Markdown
On this page
  1. Redaction: personal data stays out
  2. Moderation: 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:

sypnia.toml
[ai.tasks.chat]
safety = { redact = ["email", "phone", "card"], restore = true }
KindWhat is found
email, phonee-mail addresses and phone numbers
cardpayment card numbers
national-ididentity numbers in common national formats
addressstreet addresses
patternsyour 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

YAML
    safety:
      moderation: input      # off | input | both

The 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.

  1. Redaction: personal data stays out
  2. Moderation: check what goes in and comes out

    Search pages, sections and terms