Skip to main content

Function: moderateContent()

moderateContent(content, options): Promise<ModerationDecision>

Defined in: packages/agentos/src/safety/guardrails/contentModeration.ts:151

Judges content a person sent: every guard runs closed unless its config says failClosed: false, guards with config.sequential run first, and the decision reports codes and ids, never a guard's reason or details.

A guard's answer is read as it settles: one whose reason code or review code is in stopVendorsOn aborts the call's context.vendorSignal at once, while the other guards are still running. A request already sent is answered as usual; a guard that reads the signal starts no new one.

Parameters​

content​

ContentUnderReview

The text and the images.

options​

ModerateContentOptions

The guards, the context, the mode, the deadline and the codes that stop further vendor requests.

Returns​

Promise<ModerationDecision>

What the host does with the content.

Throws​

TypeError when a guard cannot judge input, when mode is neither enforce nor dryRun, or when context.moderation holds a field that is not a word or an id.