Skip to content

Moderation

Check text for policy violations using the moderation endpoint.

This example assumes using tryAGI.OpenAI; is in scope and apiKey contains your tryAGI.OpenAI API key.

1
2
3
4
5
6
7
using var client = new OpenAiClient(apiKey);

var response = await client.Moderations.CreateModerationAsync(
    input: "Hello, world",
    model: CreateModerationRequestModel.OmniModerationLatest);

Console.WriteLine($"Flagged: {response.Results.First().Flagged}");