GuardrailPipeline
Runs a Guardrail chain over LLM text on its way to TTS.
Defined in: src/core/pipeline/GuardrailPipeline.ts:120
Runs a Guardrail chain over LLM text on its way to TTS.
See
- GuardrailsConfig for configuration.
- GuardrailStream for the streaming counterpart.
Constructors
Constructor
new GuardrailPipeline(config, deps?): GuardrailPipeline;
Defined in: src/core/pipeline/GuardrailPipeline.ts:131
Parameters
| Parameter | Type | Description |
|---|---|---|
config | GuardrailsConfig | Filters plus chain settings. Unset fields fall back to DEFAULT_GUARDRAILS_CONFIG. |
deps | { logger?: Logger; observer?: GuardrailObserver; } | Optional logger and event observer. |
deps.logger? | Logger | - |
deps.observer? | GuardrailObserver | - |
Returns
GuardrailPipeline
Accessors
buffered
Get Signature
get buffered(): boolean;
Defined in: src/core/pipeline/GuardrailPipeline.ts:160
Whether Live TTS should hold the full response before filtering.
Returns
boolean
enabled
Get Signature
get enabled(): boolean;
Defined in: src/core/pipeline/GuardrailPipeline.ts:155
Whether the chain will actually filter anything.
Remarks
False when enabled is false or no filters are configured, letting callers skip the guardrail code path entirely.
Returns
boolean
Methods
createStream()
createStream(options): GuardrailStream;
Defined in: src/core/pipeline/GuardrailPipeline.ts:256
Create a per-utterance streaming filter for a Live TTS provider.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | GuardrailStreamOptions | Sink for surviving text plus per-utterance context. |
Returns
Remarks
One stream per generation — create it before streaming starts, push() every LLM chunk, and flush() once generation completes. Discard the stream without flushing when the turn is abandoned (barge-in, abort).
run()
run(text, context): Promise<GuardrailOutcome>;
Defined in: src/core/pipeline/GuardrailPipeline.ts:171
Run the chain over a complete piece of text.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Text to filter. |
context | GuardrailContext | Stage, accumulated text, history, and abort signal. |
Returns
Promise<GuardrailOutcome>
The surviving text and a record of what acted on it.