import { GuardrailDetector } from "../contracts/guardrail.contract.mjs"; import { OpenAiModerationOptions } from "../contracts/guard-options.type.mjs"; //#region ../ai/src/guard/detectors/moderation.d.ts /** * Build the optional `moderation` detector (surfaced as * `ai.guardrail.moderation(options?)`), backed by OpenAI's moderation * endpoint. The `openai` SDK is an **optional lazy peer**: importing * `@warlock.js/ai` never forces it to resolve, and the detector throws * a curated install string ({@link OPENAI_INSTALL_INSTRUCTIONS}) on first * `check()` when the peer is absent — mirroring ai-panoptic's lazy Langfuse * exporter. * * On a moderation hit, every flagged category becomes a * {@link GuardrailMatch}; the verdict is `block` when any flagged category is * listed in `blockOn`, otherwise `flag`. A clean result is `allow`. * * @param options - `apiKey` (defaults to `OPENAI_API_KEY`), `model` * (defaults to `"omni-moderation-latest"`), `blockOn` (categories that * escalate to `block`), or a pre-built `client` to bypass the lazy import. * @returns A {@link GuardrailDetector} for the guard's `input` / `output` / `tool` arrays. * * @example * const guard = ai.guardrail({ * output: [ * ai.guardrail.moderation({ blockOn: ["violence", "sexual/minors"] }), * ], * }); */ declare function moderation(options?: OpenAiModerationOptions): GuardrailDetector; //#endregion export { moderation }; //# sourceMappingURL=moderation.d.mts.map