1import type * as transcribe from "@distilled.cloud/aws/transcribe";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Role } from "../IAM/Role.ts";
5
6/**
7 * `CreateLanguageModel` request with `InputDataConfig.DataAccessRoleArn`
8 * defaulting to the role the binding was constructed with.
9 */
10export interface CreateLanguageModelRequest extends Omit<
11 transcribe.CreateLanguageModelRequest,
12 "InputDataConfig"
13> {
14 /**
15 * The Amazon S3 location of the training (and optional tuning) data.
16 * `DataAccessRoleArn` defaults to the data-access role bound via
17 * `CreateLanguageModel(role)`.
18 */
19 InputDataConfig: Omit<transcribe.InputDataConfig, "DataAccessRoleArn"> & {
20 DataAccessRoleArn?: string;
21 };
22}
23
24/**
25 * Runtime binding for `transcribe:CreateLanguageModel` — kick off training of
26 * a custom language model from text data in S3 (training runs asynchronously
27 * and can take multiple hours; poll with {@link DescribeLanguageModel}).
28 *
29 * The binding is constructed with the **data-access role** (the IAM role
30 * Amazon Transcribe assumes to read your S3 training data; its trust policy
31 * must allow `transcribe.amazonaws.com`). The role's ARN is injected as
32 * `InputDataConfig.DataAccessRoleArn` on every runtime request and the host
33 * is granted `iam:PassRole` on it alongside `transcribe:CreateLanguageModel`
34 * (which has no resource-level IAM).
35 *
36 * ### Custom Language Models
37 * **Example:** Create a Custom Language Model
38 * ```typescript
39 * // init — bind the Transcribe data-access role
40 * const createLanguageModel = yield* AWS.Transcribe.CreateLanguageModel(dataAccessRole);
41 *
42 * // runtime
43 * yield* createLanguageModel({
44 * ModelName: "my-domain-model",
45 * BaseModelName: "NarrowBand",
46 * LanguageCode: "en-US",
47 * InputDataConfig: { S3Uri: "s3://my-bucket/training-data/" },
48 * });
49 * ```
50 *
51 * @binding
52 */
53export interface CreateLanguageModel extends Binding.Service<
54 CreateLanguageModel,
55 "AWS.Transcribe.CreateLanguageModel",
56 <R extends Role>(
57 dataAccessRole: R,
58 ) => Effect.Effect<
59 (
60 request: CreateLanguageModelRequest,
61 ) => Effect.Effect<
62 transcribe.CreateLanguageModelResponse,
63 transcribe.CreateLanguageModelError
64 >
65 >
66> {}
67export const CreateLanguageModel = Binding.Service<CreateLanguageModel>(
68 "AWS.Transcribe.CreateLanguageModel",
69);