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

main
ts 68 lines 2.47 KB
Raw
1 import type * as sagemaker from "@distilled.cloud/aws/sagemaker-runtime";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4
5 /**
6 * The `InvokeEndpoint` request with the binding-injected `EndpointName` made
7 * optional: it defaults to the first bound endpoint name and may be
8 * overridden per call with any of the bound endpoint names (IAM is scoped to
9 * exactly those).
10 *
11 * `Body` is the raw, model-specific inference payload (the container behind
12 * the endpoint decides the shape) — there is no auto-marshalling. Set
13 * `ContentType`/`Accept` to match your container's serializer.
14 */
15 export interface InvokeEndpointRequest extends Omit<sagemaker.InvokeEndpointInput, "EndpointName"> {
16 /**
17 * The endpoint to run inference on for this call. Must be one of the
18 * endpoint names the binding was created with.
19 * @default the first bound endpoint name
20 */
21 EndpointName?: string;
22 }
23
24 /**
25 * Runtime binding for `sagemaker:InvokeEndpoint` — run real-time inference
26 * against a deployed SageMaker endpoint with a model-native request body.
27 *
28 * SageMaker Runtime is a pure pay-per-call data-plane API: the endpoint
29 * itself is provisioned out of band (a deployed SageMaker model/endpoint —
30 * costly to keep running). The binding takes one or more endpoint names and
31 * grants the function `sagemaker:InvokeEndpoint` scoped to exactly those
32 * endpoint ARNs. Pass the request/response bodies as raw bytes — the
33 * container behind the endpoint owns the payload shape, no marshalling.
34 *
35 * ### Invoking an Endpoint
36 * **Example:** Invoke a Real-Time Endpoint
37 * ```typescript
38 * // init
39 * const invokeEndpoint = yield* AWS.SageMakerRuntime.InvokeEndpoint(
40 * "my-model-endpoint",
41 * );
42 *
43 * // runtime — Body is the raw payload the container expects
44 * const result = yield* invokeEndpoint({
45 * ContentType: "application/json",
46 * Accept: "application/json",
47 * Body: JSON.stringify({ instances: [[1, 2, 3, 4]] }),
48 * });
49 * const raw = new TextDecoder().decode(result.Body);
50 * ```
51 *
52 * @binding
53 */
54 export interface InvokeEndpoint extends Binding.Service<
55 InvokeEndpoint,
56 "AWS.SageMakerRuntime.InvokeEndpoint",
57 (
58 endpoint: string,
59 ...additionalEndpoints: string[]
60 ) => Effect.Effect<
61 (
62 request: InvokeEndpointRequest,
63 ) => Effect.Effect<sagemaker.InvokeEndpointOutput, sagemaker.InvokeEndpointError>
64 >
65 > {}
66 export const InvokeEndpoint = Binding.Service<InvokeEndpoint>(
67 "AWS.SageMakerRuntime.InvokeEndpoint",
68 );