Skip to content

ModerationOptions

Options for createModerationGuardrail.

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

Options for createModerationGuardrail.

Properties

PropertyTypeDefault valueDescriptionDefined in
moderateModerationFnundefinedThe classifier to call.src/guardrails/moderation.ts:51
name?string'moderation'Guardrail name reported in events.src/guardrails/moderation.ts:86
replacement?stringundefinedText spoken in place of a flagged utterance. Remarks When set, flagged text is replaced rather than blocked, so the agent says something (“I can’t help with that”) instead of falling silent. Ignored when the verdict carries its own non-empty text.src/guardrails/moderation.ts:61
stages?readonly GuardrailStage[]['final']Stages at which to run. Remarks Defaults to ['final'] — a network round trip per streamed segment would add latency to every sentence, and the finished utterance is what a classifier can judge most reliably. Add 'chunk' deliberately, with a short timeoutMs, if you need earlier interception. That default only runs against a Live (WebSocket) TTS provider when GuardrailsConfig.mode is 'buffered'; the 'streaming' path filters every segment, flush included, at the 'chunk' stage. See GuardrailStage.src/guardrails/moderation.ts:79

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency