| 1 | import type * as bda from "@distilled.cloud/aws/bedrock-data-automation"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Blueprint } from "./Blueprint.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `InvokeBlueprintOptimizationAsync` request with the `blueprint` object |
| 8 | * (ARN + stage) injected from the bound {@link Blueprint}. |
| 9 | */ |
| 10 | export interface InvokeBlueprintOptimizationAsyncRequest extends Omit< |
| 11 | bda.InvokeBlueprintOptimizationAsyncRequest, |
| 12 | "blueprint" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for the `InvokeBlueprintOptimizationAsync` operation (IAM |
| 17 | * action `bedrock:InvokeBlueprintOptimizationAsync` on the blueprint ARN + |
| 18 | * the account's data automation profiles) — start an asynchronous job that |
| 19 | * tunes the bound blueprint's schema against labeled samples (asset + |
| 20 | * ground-truth pairs in S3) from a deployed Function. |
| 21 | * |
| 22 | * The samples and output location are read/written with the caller's S3 |
| 23 | * permissions. Poll the returned invocation with the |
| 24 | * `GetBlueprintOptimizationStatus` binding. Provide the implementation with |
| 25 | * `Effect.provide(AWS.BedrockDataAutomation.InvokeBlueprintOptimizationAsyncHttp)`. |
| 26 | * ### Blueprint Optimization |
| 27 | * **Example:** Optimize A Blueprint Against Labeled Samples |
| 28 | * ```typescript |
| 29 | * // deploy time — bind the blueprint |
| 30 | * const optimize = |
| 31 | * yield* AWS.BedrockDataAutomation.InvokeBlueprintOptimizationAsync(blueprint); |
| 32 | * |
| 33 | * // runtime — start the optimization job |
| 34 | * const { invocationArn } = yield* optimize({ |
| 35 | * samples: [ |
| 36 | * { |
| 37 | * assetS3Object: { s3Uri: `s3://${bucket}/samples/invoice-1.pdf` }, |
| 38 | * groundTruthS3Object: { s3Uri: `s3://${bucket}/samples/invoice-1.json` }, |
| 39 | * }, |
| 40 | * ], |
| 41 | * outputConfiguration: { |
| 42 | * s3Object: { s3Uri: `s3://${bucket}/optimization-results/` }, |
| 43 | * }, |
| 44 | * dataAutomationProfileArn: profileArn, |
| 45 | * }); |
| 46 | * ``` |
| 47 | * |
| 48 | * @binding |
| 49 | */ |
| 50 | export interface InvokeBlueprintOptimizationAsync extends Binding.Service< |
| 51 | InvokeBlueprintOptimizationAsync, |
| 52 | "AWS.BedrockDataAutomation.InvokeBlueprintOptimizationAsync", |
| 53 | ( |
| 54 | blueprint: Blueprint, |
| 55 | ) => Effect.Effect< |
| 56 | ( |
| 57 | request: InvokeBlueprintOptimizationAsyncRequest, |
| 58 | ) => Effect.Effect< |
| 59 | bda.InvokeBlueprintOptimizationAsyncResponse, |
| 60 | bda.InvokeBlueprintOptimizationAsyncError |
| 61 | > |
| 62 | > |
| 63 | > {} |
| 64 | export const InvokeBlueprintOptimizationAsync = |
| 65 | Binding.Service<InvokeBlueprintOptimizationAsync>( |
| 66 | "AWS.BedrockDataAutomation.InvokeBlueprintOptimizationAsync", |
| 67 | ); |