Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/openai_deno/mod.ts>OpenAI#createModeration

OpenAI API wrapper for deno.
Latest
method OpenAI.prototype.createModeration
import { OpenAI } from "https://deno.land/x/openai_deno@v0.9.8/mod.ts";

Classifies if text violates OpenAI's Content Policy

Parameters

input: string | string[]

The input text to classify

optional
model: "text-moderation-latest" | "text-moderation-stable"

Two content moderations models are available: text-moderation-stable and text-moderation-latest.

The default is text-moderation-latest which will be automatically upgraded over time. This ensures you are always using OpenAI's most accurate model. If you use text-moderation-stable, OpenAI will provide advanced notice before updating the model. Accuracy of text-moderation-stable may be slightly lower than for text-moderation-latest.

Returns

Promise<Moderation[]>

The moderation results.