ModerationFn()
Classifies text as acceptable or not.
type ModerationFn = (text, context) =>
| ModerationVerdict
| Promise<ModerationVerdict>;
Defined in: src/guardrails/moderation.ts:43
Classifies text as acceptable or not.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Text about to be spoken. |
context | GuardrailContext | Stage, accumulated text, history, and abort signal. Forward context.signal to fetch so an interrupted turn cancels the request. |
Returns
| ModerationVerdict | Promise<ModerationVerdict>