sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Comprehend/ DetectToxicContent.ts

import type * as comprehend from "@distilled.cloud/aws/comprehend";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

/**
 * Runtime binding for `comprehend:DetectToxicContent` — run toxicity
 * analysis over a list of text segments; the response carries one result per
 * segment with per-label scores (profanity, hate speech, harassment, …).
 *
 * The binding takes no arguments and grants the action on `*` (the action
 * has no resource-level IAM).
 *
 * ### Real-Time Analysis
 * **Example:** Score Text Segments for Toxicity
 * ```typescript
 * // init
 * const detectToxicContent = yield* AWS.Comprehend.DetectToxicContent();
 *
 * // runtime
 * const result = yield* detectToxicContent({
 *   TextSegments: [{ Text: "You are a wonderful person." }],
 *   LanguageCode: "en",
 * });
 * // result.ResultList[0].Toxicity ~ 0.01
 * ```
 *
 * @binding
 */
export interface DetectToxicContent extends Binding.Service<
  DetectToxicContent,
  "AWS.Comprehend.DetectToxicContent",
  () => Effect.Effect<
    (
      request: comprehend.DetectToxicContentRequest,
    ) => Effect.Effect<comprehend.DetectToxicContentResponse, comprehend.DetectToxicContentError>
  >
> {}
export const DetectToxicContent = Binding.Service<DetectToxicContent>(
  "AWS.Comprehend.DetectToxicContent",
);