@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 66 lines 2.32 KB
Raw
1 import type * as transcribe from "@distilled.cloud/aws/transcribe";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import 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 */
10 export 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 */
53 export 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<transcribe.CreateLanguageModelResponse, transcribe.CreateLanguageModelError>
62 >
63 > {}
64 export const CreateLanguageModel = Binding.Service<CreateLanguageModel>(
65 "AWS.Transcribe.CreateLanguageModel",
66 );