GuardrailObserver
Hooks the pipeline calls as guardrails act, so the SDK can turn them into guardrail.* events.
Defined in: src/core/pipeline/GuardrailPipeline.ts:71
Hooks the pipeline calls as guardrails act, so the SDK can turn them into guardrail.* events.
Remarks
Every method is optional and invoked synchronously. Handlers must not throw.
Methods
onApplied()?
optional onApplied(application): void;
Defined in: src/core/pipeline/GuardrailPipeline.ts:73
A guardrail rewrote the text.
Parameters
| Parameter | Type |
|---|---|
application | GuardrailApplication & { stage: GuardrailStage; } |
Returns
void
onBlocked()?
optional onBlocked(application): void;
Defined in: src/core/pipeline/GuardrailPipeline.ts:75
A guardrail suppressed the text.
Parameters
| Parameter | Type |
|---|---|
application | GuardrailApplication & { stage: GuardrailStage; } |
Returns
void
onError()?
optional onError(info): void;
Defined in: src/core/pipeline/GuardrailPipeline.ts:77
A guardrail threw or timed out.
Parameters
| Parameter | Type |
|---|---|
info | { error: Error; guardrail: string; policy: "passthrough" | "block"; stage: GuardrailStage; } |
info.error | Error |
info.guardrail | string |
info.policy | "passthrough" | "block" |
info.stage | GuardrailStage |
Returns
void