import { InputGuardrail, OutputGuardrail } from "../types.js"; //#region src/guardrails/builtins/llm-moderation.d.ts /** * Decision returned by a moderation provider. Designed to mirror the * common shape exposed by mainstream moderation endpoints. * * @stable */ interface ModerationDecision { readonly flagged: boolean; readonly categories?: ReadonlyArray; readonly score?: number; readonly reason?: string; } /** * Provider callback. The runtime injects an async function that * forwards the value to a moderation service and returns the * decision. * * @stable */ type ModerationProvider = (value: string) => Promise | ModerationDecision; /** * Options for `llmModeration(...)` (input) and `outputModeration(...)` * (output). * * @stable */ interface ModerationGuardrailOptions { readonly provider: ModerationProvider; /** Confidence threshold; values above the threshold are flagged. */ readonly threshold?: number; /** Action to take on a flagged decision. Defaults to `'block'`. */ readonly action?: 'block' | 'warn'; /** Override the guardrail name. */ readonly name?: string; /** Categories that always trigger a block, even if the score is below threshold. */ readonly blockCategories?: ReadonlyArray; } /** * Construct an input-side moderation guardrail. * * @stable */ declare function llmModeration(opts: ModerationGuardrailOptions): InputGuardrail; /** * Construct an output-side moderation guardrail. * * @stable */ declare function outputModeration(opts: ModerationGuardrailOptions): OutputGuardrail; //#endregion export { ModerationDecision, ModerationGuardrailOptions, ModerationProvider, llmModeration, outputModeration }; //# sourceMappingURL=llm-moderation.d.ts.map