| 1 | import type * as comprehend from "@distilled.cloud/aws/comprehend"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `comprehend:DetectToxicContent` — run toxicity |
| 7 | * analysis over a list of text segments; the response carries one result per |
| 8 | * segment with per-label scores (profanity, hate speech, harassment, …). |
| 9 | * |
| 10 | * The binding takes no arguments and grants the action on `*` (the action |
| 11 | * has no resource-level IAM). |
| 12 | * |
| 13 | * ### Real-Time Analysis |
| 14 | * **Example:** Score Text Segments for Toxicity |
| 15 | * ```typescript |
| 16 | * // init |
| 17 | * const detectToxicContent = yield* AWS.Comprehend.DetectToxicContent(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const result = yield* detectToxicContent({ |
| 21 | * TextSegments: [{ Text: "You are a wonderful person." }], |
| 22 | * LanguageCode: "en", |
| 23 | * }); |
| 24 | * // result.ResultList[0].Toxicity ~ 0.01 |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface DetectToxicContent extends Binding.Service< |
| 30 | DetectToxicContent, |
| 31 | "AWS.Comprehend.DetectToxicContent", |
| 32 | () => Effect.Effect< |
| 33 | ( |
| 34 | request: comprehend.DetectToxicContentRequest, |
| 35 | ) => Effect.Effect< |
| 36 | comprehend.DetectToxicContentResponse, |
| 37 | comprehend.DetectToxicContentError |
| 38 | > |
| 39 | > |
| 40 | > {} |
| 41 | export const DetectToxicContent = Binding.Service<DetectToxicContent>( |
| 42 | "AWS.Comprehend.DetectToxicContent", |
| 43 | ); |