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
| Parameter | Type |
|---|---|
options | BlocklistOptions |
Returns
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.