| 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:ClassifyDocument` — classify a single |
| 7 | * document in real time against a custom classifier endpoint or a |
| 8 | * Comprehend prebuilt model ARN (`EndpointArn`). |
| 9 | * |
| 10 | * The binding takes no arguments and grants the action on `*` — endpoints |
| 11 | * are addressed per-request via `EndpointArn`, so the grant cannot be |
| 12 | * scoped tighter at deploy time. |
| 13 | * |
| 14 | * ### Real-Time Analysis |
| 15 | * **Example:** Classify a Document Against a Custom Endpoint |
| 16 | * ```typescript |
| 17 | * // init |
| 18 | * const classifyDocument = yield* AWS.Comprehend.ClassifyDocument(); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const result = yield* classifyDocument({ |
| 22 | * Text: "Subject: your invoice for March is attached", |
| 23 | * EndpointArn: endpointArn, |
| 24 | * }); |
| 25 | * // result.Classes: [{ Name: "INVOICE", Score: 0.98 }, …] |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface ClassifyDocument extends Binding.Service< |
| 31 | ClassifyDocument, |
| 32 | "AWS.Comprehend.ClassifyDocument", |
| 33 | () => Effect.Effect< |
| 34 | ( |
| 35 | request: comprehend.ClassifyDocumentRequest, |
| 36 | ) => Effect.Effect< |
| 37 | comprehend.ClassifyDocumentResponse, |
| 38 | comprehend.ClassifyDocumentError |
| 39 | > |
| 40 | > |
| 41 | > {} |
| 42 | export const ClassifyDocument = Binding.Service<ClassifyDocument>( |
| 43 | "AWS.Comprehend.ClassifyDocument", |
| 44 | ); |