Skip to content

ModerationFn()

Classifies text as acceptable or not.

type ModerationFn = (text, context) => 
  | ModerationVerdict
| Promise<ModerationVerdict>;

Defined in: src/guardrails/moderation.ts:43

Classifies text as acceptable or not.

Parameters

ParameterTypeDescription
textstringText about to be spoken.
contextGuardrailContextStage, accumulated text, history, and abort signal. Forward context.signal to fetch so an interrupted turn cancels the request.

Returns

| ModerationVerdict | Promise<ModerationVerdict>

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency