| 1 | import type * as featurestore from "@distilled.cloud/aws/sagemaker-featurestore-runtime"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { FeatureGroup } from "./FeatureGroup.ts"; |
| 5 | |
| 6 | export interface PutRecordRequest extends Omit< |
| 7 | featurestore.PutRecordRequest, |
| 8 | "FeatureGroupName" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `sagemaker:PutRecord` — write a record to a |
| 13 | * `FeatureGroup`'s online store (and, when configured, its offline store). |
| 14 | * |
| 15 | * Bind this operation to a `FeatureGroup` inside a function runtime to get a |
| 16 | * callable that automatically injects the feature group name. Every feature |
| 17 | * value is passed as a string (`ValueAsString`) — the feature group's schema |
| 18 | * declares the actual types. |
| 19 | * ### Writing Records |
| 20 | * **Example:** Put a Record |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const putRecord = yield* AWS.SageMaker.PutRecord(featureGroup); |
| 24 | * |
| 25 | * // runtime |
| 26 | * yield* putRecord({ |
| 27 | * Record: [ |
| 28 | * { FeatureName: "user_id", ValueAsString: "user-123" }, |
| 29 | * { FeatureName: "event_time", ValueAsString: new Date().toISOString() }, |
| 30 | * { FeatureName: "clicks", ValueAsString: "42" }, |
| 31 | * ], |
| 32 | * }); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface PutRecord extends Binding.Service< |
| 38 | PutRecord, |
| 39 | "AWS.SageMaker.PutRecord", |
| 40 | <F extends FeatureGroup>( |
| 41 | featureGroup: F, |
| 42 | ) => Effect.Effect< |
| 43 | ( |
| 44 | request: PutRecordRequest, |
| 45 | ) => Effect.Effect< |
| 46 | featurestore.PutRecordResponse, |
| 47 | featurestore.PutRecordError |
| 48 | > |
| 49 | > |
| 50 | > {} |
| 51 | export const PutRecord = Binding.Service<PutRecord>("AWS.SageMaker.PutRecord"); |