ModerationResult

Represents the result of a content moderation request.

Constructors

Link copied to clipboard
constructor(isHarmful: Boolean, categories: Map<ModerationCategory, ModerationCategoryResult>)

Types

Link copied to clipboard

Represents the type of input provided for content moderation.

Properties

Link copied to clipboard

A map of ModerationCategory objects to ModerationCategoryResult values indicating whether each category is flagged with metainformation about assessment.

Link copied to clipboard

Whether the content is classified as harmful (i.e. any of the categories are flagged).

Link copied to clipboard

A list of moderation categories that have been flagged as detected in the moderation result.

Functions

Link copied to clipboard
fun violatesAll(vararg checkedCategories: ModerationCategory): Boolean

Checks if all the provided moderation categories are violated in this moderation result.

Link copied to clipboard

Checks if the specified moderation category is flagged as detected in the moderation result.

Link copied to clipboard
fun violatesOneOf(vararg checkedCategories: ModerationCategory): Boolean

Evaluates whether the content violates any of the specified moderation categories.