Load the model, classify your first conversation and turn the scores into flags.
End-to-end usage with pipeline
pipeline is the quickest way to use ICG end-to-end with only a couple of Python lines
Classify a conversation
ICG supports OAI chat completions conversation or ICG formatted input conversations
The output carries one probability per category for the request and, when the input has a response, for the response. The values below are real model output for the conversation above.
response is null when the input ends with a user message.
Classify with full control
Load the model yourself, prepare your input conversations accordingly, get the request and response positions, and get all token logits.
Turn scores into flags
This function compares each category’s score with that category’s threshold, then maps the highest crossing score to an action. It runs as is on the output above (save the output as a Python dict named output).
On the output it returns:
Read this as: the request asks to unmask a private person, so privacy (1.00) and cyber (0.86) both cross their thresholds, and the higher of the two puts the request in the block bucket. The response is a refusal, so every category scores near zero. illegal_activities (0.42) and grooming (0.39) are raised on the request but stay unflagged because they fall below 0.5.
Tips
-
Send only role and content. See the input requirements for supported roles and how the classifier handles extra fields.
-
Long conversations are refused, not cut. If you must shorten one, drop early turns: the last request and reply are what get scored.
-
One call scores both heads. Include the reply when you have it; the request scores come back either way.
-
A refusal scores high on the request and low on the response. The example above shows this: the user asked for something violative and the model declined.
-
Scores do not sum to 1. Each category is independent, so several can be high at once.
Last modified on November 30, 2026