Skip to content

createBlocklistGuardrail

Create a guardrail that blocks or redacts forbidden terms and patterns.

function createBlocklistGuardrail(options): Guardrail;

Defined in: src/guardrails/blocklist.ts:121

Create a guardrail that blocks or redacts forbidden terms and patterns.

Parameters

ParameterType
optionsBlocklistOptions

Returns

Guardrail

Example

guardrails: {
  filters: [
    createBlocklistGuardrail({
      name: 'codenames',
      terms: ['Project Halcyon', 'Titan-2'],
    }),
    createBlocklistGuardrail({
      name: 'profanity',
      terms: [...profanityList],
      action: 'redact',
      replacement: '—',
    }),
  ],
}

Remarks

A 'block' result at the 'chunk' stage cannot recall audio the TTS provider has already received. Set mode: 'buffered' on the guardrails config when a blocked term must never be partially spoken.

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency