| 1 | import type * as textract from "@distilled.cloud/aws/textract"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Adapter } from "./Adapter.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `textract:CreateAdapterVersion` — train a new |
| 8 | * version of the bound adapter from an annotated dataset manifest in S3 |
| 9 | * (automated retraining pipelines). The `AdapterId` is injected |
| 10 | * automatically; the caller also needs read access to the manifest and |
| 11 | * write access to the output bucket. |
| 12 | * |
| 13 | * ### Managing Adapters |
| 14 | * **Example:** Train a New Adapter Version |
| 15 | * ```typescript |
| 16 | * // init |
| 17 | * const createAdapterVersion = yield* AWS.Textract.CreateAdapterVersion(adapter); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { AdapterVersion } = yield* createAdapterVersion({ |
| 21 | * DatasetConfig: { |
| 22 | * ManifestS3Object: { Bucket: bucketName, Name: "manifest.jsonl" }, |
| 23 | * }, |
| 24 | * OutputConfig: { S3Bucket: bucketName, S3Prefix: "training-output/" }, |
| 25 | * }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface CreateAdapterVersion extends Binding.Service< |
| 31 | CreateAdapterVersion, |
| 32 | "AWS.Textract.CreateAdapterVersion", |
| 33 | <A extends Adapter>( |
| 34 | adapter: A, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: Omit<textract.CreateAdapterVersionRequest, "AdapterId">, |
| 38 | ) => Effect.Effect< |
| 39 | textract.CreateAdapterVersionResponse, |
| 40 | textract.CreateAdapterVersionError |
| 41 | > |
| 42 | > |
| 43 | > {} |
| 44 | export const CreateAdapterVersion = Binding.Service<CreateAdapterVersion>( |
| 45 | "AWS.Textract.CreateAdapterVersion", |
| 46 | ); |