Console ↗

Live chat filtering

Apply distinct moderation rules to a chat message while preserving ordinary discussion.

Input and workflow

Process messages by ID and restore display order after concurrent requests. A spoiler can be collapsed without removing the entire message.

Request

{
  "model": "ngila-judge",
  "state": "Spoiler for the finale: the captain returns home.",
  "questions": {
    "spoiler": {
      "type": "noul",
      "instructions": "Does the message reveal a plot outcome?"
    },
    "abuse": {
      "type": "noul",
      "instructions": "Does it target a participant with abuse?"
    }
  }
}

Open request in Playground →

Run locally

Save ngila.py alongside your script and set NGILA_API_KEY. Save any linked input images in the same directory.

import json
from ngila import NgilaClient

state = 'Spoiler for the finale: the captain returns home.'
questions = {'spoiler': {'type': 'noul',
             'instructions': 'Does the message reveal a plot outcome?'},
 'abuse': {'type': 'noul',
           'instructions': 'Does it target a participant with abuse?'}}

response = NgilaClient().system_one(state, questions)
a = response["answers"]
print(json.dumps(a, indent=2, ensure_ascii=False))

Use the answers

The following application fragment uses a = response["answers"]. Supply any thresholds, lookup tables, or previous results from your workflow before applying it.

style = "collapsed" if a["spoiler"]["noul"] >= spoiler_threshold else "visible"

Browse cookbooks · System One request and response