1import type * as sagemaker from "@distilled.cloud/aws/sagemaker-runtime";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * The `InvokeEndpointAsync` request with the binding-injected `EndpointName`
7 * made optional: it defaults to the first bound endpoint name and may be
8 * overridden per call with any of the bound endpoint names.
9 *
10 * `InputLocation` is the S3 URI of the request payload; the response returns
11 * an `OutputLocation` S3 URI the container writes the result to. Grant the
12 * function S3 access to those buckets separately.
13 */
14export interface InvokeEndpointAsyncRequest extends Omit<
15 sagemaker.InvokeEndpointAsyncInput,
16 "EndpointName"
17> {
18 /**
19 * The endpoint to run inference on for this call. Must be one of the
20 * endpoint names the binding was created with.
21 * @default the first bound endpoint name
22 */
23 EndpointName?: string;
24}
25
26/**
27 * Runtime binding for `sagemaker:InvokeEndpointAsync` — enqueue an
28 * asynchronous inference request against a deployed SageMaker async endpoint.
29 * The request payload is read from S3 (`InputLocation`) and the result is
30 * written back to S3; the call returns immediately with an `OutputLocation`.
31 *
32 * The binding takes one or more endpoint names and grants the function
33 * `sagemaker:InvokeEndpointAsync` scoped to exactly those endpoint ARNs.
34 *
35 * ### Invoking an Async Endpoint
36 * **Example:** Enqueue an Async Inference Request
37 * ```typescript
38 * // init
39 * const invokeAsync = yield* AWS.SageMakerRuntime.InvokeEndpointAsync(
40 * "my-async-endpoint",
41 * );
42 *
43 * // runtime
44 * const result = yield* invokeAsync({
45 * ContentType: "application/json",
46 * InputLocation: "s3://my-bucket/input/request.json",
47 * });
48 * // result.OutputLocation — poll S3 for the written inference result
49 * ```
50 *
51 * @binding
52 */
53export interface InvokeEndpointAsync extends Binding.Service<
54 InvokeEndpointAsync,
55 "AWS.SageMakerRuntime.InvokeEndpointAsync",
56 (
57 endpoint: string,
58 ...additionalEndpoints: string[]
59 ) => Effect.Effect<
60 (
61 request: InvokeEndpointAsyncRequest,
62 ) => Effect.Effect<
63 sagemaker.InvokeEndpointAsyncOutput,
64 sagemaker.InvokeEndpointAsyncError
65 >
66 >
67> {}
68export const InvokeEndpointAsync = Binding.Service<InvokeEndpointAsync>(
69 "AWS.SageMakerRuntime.InvokeEndpointAsync",
70);