sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Comprehend/ ClassifyDocument.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:ClassifyDocument` — classify a single
 * document in real time against a custom classifier endpoint or a
 * Comprehend prebuilt model ARN (`EndpointArn`).
 *
 * The binding takes no arguments and grants the action on `*` — endpoints
 * are addressed per-request via `EndpointArn`, so the grant cannot be
 * scoped tighter at deploy time.
 *
 * ### Real-Time Analysis
 * **Example:** Classify a Document Against a Custom Endpoint
 * ```typescript
 * // init
 * const classifyDocument = yield* AWS.Comprehend.ClassifyDocument();
 *
 * // runtime
 * const result = yield* classifyDocument({
 *   Text: "Subject: your invoice for March is attached",
 *   EndpointArn: endpointArn,
 * });
 * // result.Classes: [{ Name: "INVOICE", Score: 0.98 }, …]
 * ```
 *
 * @binding
 */
export interface ClassifyDocument extends Binding.Service<
  ClassifyDocument,
  "AWS.Comprehend.ClassifyDocument",
  () => Effect.Effect<
    (
      request: comprehend.ClassifyDocumentRequest,
    ) => Effect.Effect<comprehend.ClassifyDocumentResponse, comprehend.ClassifyDocumentError>
  >
> {}
export const ClassifyDocument = Binding.Service<ClassifyDocument>(
  "AWS.Comprehend.ClassifyDocument",
);