@aws-sdk/client-sagemaker-runtime 3.398.0 → 3.404.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +8 -0
  2. package/dist-cjs/SageMakerRuntime.js +2 -0
  3. package/dist-cjs/SageMakerRuntimeClient.js +5 -3
  4. package/dist-cjs/commands/InvokeEndpointWithResponseStreamCommand.js +47 -0
  5. package/dist-cjs/commands/index.js +1 -0
  6. package/dist-cjs/endpoint/ruleset.js +1 -1
  7. package/dist-cjs/models/models_0.js +70 -1
  8. package/dist-cjs/protocols/Aws_restJson1.js +144 -1
  9. package/dist-cjs/runtimeConfig.browser.js +2 -0
  10. package/dist-cjs/runtimeConfig.js +2 -0
  11. package/dist-es/SageMakerRuntime.js +2 -0
  12. package/dist-es/SageMakerRuntimeClient.js +5 -3
  13. package/dist-es/commands/InvokeEndpointWithResponseStreamCommand.js +43 -0
  14. package/dist-es/commands/index.js +1 -0
  15. package/dist-es/endpoint/ruleset.js +1 -1
  16. package/dist-es/models/models_0.js +63 -0
  17. package/dist-es/protocols/Aws_restJson1.js +142 -1
  18. package/dist-es/runtimeConfig.browser.js +2 -0
  19. package/dist-es/runtimeConfig.js +2 -0
  20. package/dist-types/SageMakerRuntime.d.ts +7 -0
  21. package/dist-types/SageMakerRuntimeClient.d.ts +11 -5
  22. package/dist-types/commands/InvokeEndpointAsyncCommand.d.ts +8 -8
  23. package/dist-types/commands/InvokeEndpointCommand.d.ts +7 -8
  24. package/dist-types/commands/InvokeEndpointWithResponseStreamCommand.d.ts +151 -0
  25. package/dist-types/commands/index.d.ts +1 -0
  26. package/dist-types/models/models_0.d.ts +326 -61
  27. package/dist-types/protocols/Aws_restJson1.d.ts +10 -1
  28. package/dist-types/runtimeConfig.browser.d.ts +1 -0
  29. package/dist-types/runtimeConfig.d.ts +1 -0
  30. package/dist-types/runtimeConfig.native.d.ts +1 -0
  31. package/dist-types/ts3.4/SageMakerRuntime.d.ts +17 -0
  32. package/dist-types/ts3.4/SageMakerRuntimeClient.d.ts +16 -2
  33. package/dist-types/ts3.4/commands/InvokeEndpointWithResponseStreamCommand.d.ts +49 -0
  34. package/dist-types/ts3.4/commands/index.d.ts +1 -0
  35. package/dist-types/ts3.4/models/models_0.d.ts +82 -0
  36. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +16 -1
  37. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
  38. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
  39. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
  40. package/package.json +4 -1
@@ -1,6 +1,6 @@
1
1
  import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
2
  import { collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@smithy/smithy-client";
3
- import { InternalDependencyException, InternalFailure, ModelError, ModelNotReadyException, ServiceUnavailable, ValidationError, } from "../models/models_0";
3
+ import { InternalDependencyException, InternalFailure, InternalStreamFailure, ModelError, ModelNotReadyException, ModelStreamError, ServiceUnavailable, ValidationError, } from "../models/models_0";
4
4
  import { SageMakerRuntimeServiceException as __BaseException } from "../models/SageMakerRuntimeServiceException";
5
5
  export const se_InvokeEndpointCommand = async (input, context) => {
6
6
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -61,6 +61,33 @@ export const se_InvokeEndpointAsyncCommand = async (input, context) => {
61
61
  body,
62
62
  });
63
63
  };
64
+ export const se_InvokeEndpointWithResponseStreamCommand = async (input, context) => {
65
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
66
+ const headers = map({}, isSerializableHeaderValue, {
67
+ "content-type": input.ContentType || "application/octet-stream",
68
+ "x-amzn-sagemaker-accept": input.Accept,
69
+ "x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
70
+ "x-amzn-sagemaker-target-variant": input.TargetVariant,
71
+ "x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname,
72
+ "x-amzn-sagemaker-inference-id": input.InferenceId,
73
+ });
74
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
75
+ "/endpoints/{EndpointName}/invocations-response-stream";
76
+ resolvedPath = __resolvedPath(resolvedPath, input, "EndpointName", () => input.EndpointName, "{EndpointName}", false);
77
+ let body;
78
+ if (input.Body !== undefined) {
79
+ body = input.Body;
80
+ }
81
+ return new __HttpRequest({
82
+ protocol,
83
+ hostname,
84
+ port,
85
+ method: "POST",
86
+ headers,
87
+ path: resolvedPath,
88
+ body,
89
+ });
90
+ };
64
91
  export const de_InvokeEndpointCommand = async (output, context) => {
65
92
  if (output.statusCode !== 200 && output.statusCode >= 300) {
66
93
  return de_InvokeEndpointCommandError(output, context);
@@ -150,6 +177,54 @@ const de_InvokeEndpointAsyncCommandError = async (output, context) => {
150
177
  });
151
178
  }
152
179
  };
180
+ export const de_InvokeEndpointWithResponseStreamCommand = async (output, context) => {
181
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
182
+ return de_InvokeEndpointWithResponseStreamCommandError(output, context);
183
+ }
184
+ const contents = map({
185
+ $metadata: deserializeMetadata(output),
186
+ ContentType: [, output.headers["x-amzn-sagemaker-content-type"]],
187
+ InvokedProductionVariant: [, output.headers["x-amzn-invoked-production-variant"]],
188
+ CustomAttributes: [, output.headers["x-amzn-sagemaker-custom-attributes"]],
189
+ });
190
+ const data = output.body;
191
+ contents.Body = de_ResponseStream(data, context);
192
+ return contents;
193
+ };
194
+ const de_InvokeEndpointWithResponseStreamCommandError = async (output, context) => {
195
+ const parsedOutput = {
196
+ ...output,
197
+ body: await parseErrorBody(output.body, context),
198
+ };
199
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
200
+ switch (errorCode) {
201
+ case "InternalFailure":
202
+ case "com.amazonaws.sagemakerruntime#InternalFailure":
203
+ throw await de_InternalFailureRes(parsedOutput, context);
204
+ case "InternalStreamFailure":
205
+ case "com.amazonaws.sagemakerruntime#InternalStreamFailure":
206
+ throw await de_InternalStreamFailureRes(parsedOutput, context);
207
+ case "ModelError":
208
+ case "com.amazonaws.sagemakerruntime#ModelError":
209
+ throw await de_ModelErrorRes(parsedOutput, context);
210
+ case "ModelStreamError":
211
+ case "com.amazonaws.sagemakerruntime#ModelStreamError":
212
+ throw await de_ModelStreamErrorRes(parsedOutput, context);
213
+ case "ServiceUnavailable":
214
+ case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
215
+ throw await de_ServiceUnavailableRes(parsedOutput, context);
216
+ case "ValidationError":
217
+ case "com.amazonaws.sagemakerruntime#ValidationError":
218
+ throw await de_ValidationErrorRes(parsedOutput, context);
219
+ default:
220
+ const parsedBody = parsedOutput.body;
221
+ return throwDefaultError({
222
+ output,
223
+ parsedBody,
224
+ errorCode,
225
+ });
226
+ }
227
+ };
153
228
  const throwDefaultError = withBaseException(__BaseException);
154
229
  const de_InternalDependencyExceptionRes = async (parsedOutput, context) => {
155
230
  const contents = map({});
@@ -177,6 +252,19 @@ const de_InternalFailureRes = async (parsedOutput, context) => {
177
252
  });
178
253
  return __decorateServiceException(exception, parsedOutput.body);
179
254
  };
255
+ const de_InternalStreamFailureRes = async (parsedOutput, context) => {
256
+ const contents = map({});
257
+ const data = parsedOutput.body;
258
+ const doc = take(data, {
259
+ Message: __expectString,
260
+ });
261
+ Object.assign(contents, doc);
262
+ const exception = new InternalStreamFailure({
263
+ $metadata: deserializeMetadata(parsedOutput),
264
+ ...contents,
265
+ });
266
+ return __decorateServiceException(exception, parsedOutput.body);
267
+ };
180
268
  const de_ModelErrorRes = async (parsedOutput, context) => {
181
269
  const contents = map({});
182
270
  const data = parsedOutput.body;
@@ -206,6 +294,20 @@ const de_ModelNotReadyExceptionRes = async (parsedOutput, context) => {
206
294
  });
207
295
  return __decorateServiceException(exception, parsedOutput.body);
208
296
  };
297
+ const de_ModelStreamErrorRes = async (parsedOutput, context) => {
298
+ const contents = map({});
299
+ const data = parsedOutput.body;
300
+ const doc = take(data, {
301
+ ErrorCode: __expectString,
302
+ Message: __expectString,
303
+ });
304
+ Object.assign(contents, doc);
305
+ const exception = new ModelStreamError({
306
+ $metadata: deserializeMetadata(parsedOutput),
307
+ ...contents,
308
+ });
309
+ return __decorateServiceException(exception, parsedOutput.body);
310
+ };
209
311
  const de_ServiceUnavailableRes = async (parsedOutput, context) => {
210
312
  const contents = map({});
211
313
  const data = parsedOutput.body;
@@ -232,6 +334,45 @@ const de_ValidationErrorRes = async (parsedOutput, context) => {
232
334
  });
233
335
  return __decorateServiceException(exception, parsedOutput.body);
234
336
  };
337
+ const de_ResponseStream = (output, context) => {
338
+ return context.eventStreamMarshaller.deserialize(output, async (event) => {
339
+ if (event["PayloadPart"] != null) {
340
+ return {
341
+ PayloadPart: await de_PayloadPart_event(event["PayloadPart"], context),
342
+ };
343
+ }
344
+ if (event["ModelStreamError"] != null) {
345
+ return {
346
+ ModelStreamError: await de_ModelStreamError_event(event["ModelStreamError"], context),
347
+ };
348
+ }
349
+ if (event["InternalStreamFailure"] != null) {
350
+ return {
351
+ InternalStreamFailure: await de_InternalStreamFailure_event(event["InternalStreamFailure"], context),
352
+ };
353
+ }
354
+ return { $unknown: output };
355
+ });
356
+ };
357
+ const de_InternalStreamFailure_event = async (output, context) => {
358
+ const parsedOutput = {
359
+ ...output,
360
+ body: await parseBody(output.body, context),
361
+ };
362
+ return de_InternalStreamFailureRes(parsedOutput, context);
363
+ };
364
+ const de_ModelStreamError_event = async (output, context) => {
365
+ const parsedOutput = {
366
+ ...output,
367
+ body: await parseBody(output.body, context),
368
+ };
369
+ return de_ModelStreamErrorRes(parsedOutput, context);
370
+ };
371
+ const de_PayloadPart_event = async (output, context) => {
372
+ const contents = {};
373
+ contents.Bytes = output.body;
374
+ return contents;
375
+ };
235
376
  const deserializeMetadata = (output) => ({
236
377
  httpStatusCode: output.statusCode,
237
378
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -2,6 +2,7 @@ import packageInfo from "../package.json";
2
2
  import { Sha256 } from "@aws-crypto/sha256-browser";
3
3
  import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
4
4
  import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
5
+ import { eventStreamSerdeProvider } from "@smithy/eventstream-serde-browser";
5
6
  import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
6
7
  import { invalidProvider } from "@smithy/invalid-dependency";
7
8
  import { calculateBodyLength } from "@smithy/util-body-length-browser";
@@ -22,6 +23,7 @@ export const getRuntimeConfig = (config) => {
22
23
  credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
23
24
  defaultUserAgentProvider: config?.defaultUserAgentProvider ??
24
25
  defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
26
+ eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
25
27
  maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
26
28
  region: config?.region ?? invalidProvider("Region is missing"),
27
29
  requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
@@ -3,6 +3,7 @@ import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
3
3
  import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
4
4
  import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
5
5
  import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
6
+ import { eventStreamSerdeProvider } from "@smithy/eventstream-serde-node";
6
7
  import { Hash } from "@smithy/hash-node";
7
8
  import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
8
9
  import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
@@ -27,6 +28,7 @@ export const getRuntimeConfig = (config) => {
27
28
  credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
28
29
  defaultUserAgentProvider: config?.defaultUserAgentProvider ??
29
30
  defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
31
+ eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
30
32
  maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
31
33
  region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
32
34
  requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
@@ -1,6 +1,7 @@
1
1
  import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";
2
2
  import { InvokeEndpointAsyncCommandInput, InvokeEndpointAsyncCommandOutput } from "./commands/InvokeEndpointAsyncCommand";
3
3
  import { InvokeEndpointCommandInput, InvokeEndpointCommandOutput } from "./commands/InvokeEndpointCommand";
4
+ import { InvokeEndpointWithResponseStreamCommandInput, InvokeEndpointWithResponseStreamCommandOutput } from "./commands/InvokeEndpointWithResponseStreamCommand";
4
5
  import { SageMakerRuntimeClient } from "./SageMakerRuntimeClient";
5
6
  export interface SageMakerRuntime {
6
7
  /**
@@ -15,6 +16,12 @@ export interface SageMakerRuntime {
15
16
  invokeEndpointAsync(args: InvokeEndpointAsyncCommandInput, options?: __HttpHandlerOptions): Promise<InvokeEndpointAsyncCommandOutput>;
16
17
  invokeEndpointAsync(args: InvokeEndpointAsyncCommandInput, cb: (err: any, data?: InvokeEndpointAsyncCommandOutput) => void): void;
17
18
  invokeEndpointAsync(args: InvokeEndpointAsyncCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeEndpointAsyncCommandOutput) => void): void;
19
+ /**
20
+ * @see {@link InvokeEndpointWithResponseStreamCommand}
21
+ */
22
+ invokeEndpointWithResponseStream(args: InvokeEndpointWithResponseStreamCommandInput, options?: __HttpHandlerOptions): Promise<InvokeEndpointWithResponseStreamCommandOutput>;
23
+ invokeEndpointWithResponseStream(args: InvokeEndpointWithResponseStreamCommandInput, cb: (err: any, data?: InvokeEndpointWithResponseStreamCommandOutput) => void): void;
24
+ invokeEndpointWithResponseStream(args: InvokeEndpointWithResponseStreamCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeEndpointWithResponseStreamCommandOutput) => void): void;
18
25
  }
19
26
  /**
20
27
  * @public
@@ -3,24 +3,26 @@ import { AwsAuthInputConfig, AwsAuthResolvedConfig } from "@aws-sdk/middleware-s
3
3
  import { UserAgentInputConfig, UserAgentResolvedConfig } from "@aws-sdk/middleware-user-agent";
4
4
  import { Credentials as __Credentials } from "@aws-sdk/types";
5
5
  import { RegionInputConfig, RegionResolvedConfig } from "@smithy/config-resolver";
6
+ import { EventStreamSerdeInputConfig, EventStreamSerdeResolvedConfig } from "@smithy/eventstream-serde-config-resolver";
6
7
  import { EndpointInputConfig, EndpointResolvedConfig } from "@smithy/middleware-endpoint";
7
8
  import { RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry";
8
9
  import { HttpHandler as __HttpHandler } from "@smithy/protocol-http";
9
10
  import { Client as __Client, DefaultsMode as __DefaultsMode, SmithyConfiguration as __SmithyConfiguration, SmithyResolvedConfiguration as __SmithyResolvedConfiguration } from "@smithy/smithy-client";
10
- import { BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, Decoder as __Decoder, Encoder as __Encoder, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent } from "@smithy/types";
11
+ import { BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, Decoder as __Decoder, Encoder as __Encoder, EventStreamSerdeProvider as __EventStreamSerdeProvider, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent } from "@smithy/types";
11
12
  import { InvokeEndpointAsyncCommandInput, InvokeEndpointAsyncCommandOutput } from "./commands/InvokeEndpointAsyncCommand";
12
13
  import { InvokeEndpointCommandInput, InvokeEndpointCommandOutput } from "./commands/InvokeEndpointCommand";
14
+ import { InvokeEndpointWithResponseStreamCommandInput, InvokeEndpointWithResponseStreamCommandOutput } from "./commands/InvokeEndpointWithResponseStreamCommand";
13
15
  import { ClientInputEndpointParameters, ClientResolvedEndpointParameters, EndpointParameters } from "./endpoint/EndpointParameters";
14
16
  import { RuntimeExtension, RuntimeExtensionsConfig } from "./runtimeExtensions";
15
17
  export { __Client };
16
18
  /**
17
19
  * @public
18
20
  */
19
- export type ServiceInputTypes = InvokeEndpointAsyncCommandInput | InvokeEndpointCommandInput;
21
+ export type ServiceInputTypes = InvokeEndpointAsyncCommandInput | InvokeEndpointCommandInput | InvokeEndpointWithResponseStreamCommandInput;
20
22
  /**
21
23
  * @public
22
24
  */
23
- export type ServiceOutputTypes = InvokeEndpointAsyncCommandOutput | InvokeEndpointCommandOutput;
25
+ export type ServiceOutputTypes = InvokeEndpointAsyncCommandOutput | InvokeEndpointCommandOutput | InvokeEndpointWithResponseStreamCommandOutput;
24
26
  /**
25
27
  * @public
26
28
  */
@@ -123,6 +125,10 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
123
125
  * Optional extensions
124
126
  */
125
127
  extensions?: RuntimeExtension[];
128
+ /**
129
+ * The function that provides necessary utilities for generating and parsing event stream
130
+ */
131
+ eventStreamSerdeProvider?: __EventStreamSerdeProvider;
126
132
  /**
127
133
  * The {@link @smithy/smithy-client#DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK.
128
134
  */
@@ -131,7 +137,7 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
131
137
  /**
132
138
  * @public
133
139
  */
134
- export type SageMakerRuntimeClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & RegionInputConfig & EndpointInputConfig<EndpointParameters> & RetryInputConfig & HostHeaderInputConfig & AwsAuthInputConfig & UserAgentInputConfig & ClientInputEndpointParameters;
140
+ export type SageMakerRuntimeClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & RegionInputConfig & EndpointInputConfig<EndpointParameters> & RetryInputConfig & HostHeaderInputConfig & AwsAuthInputConfig & UserAgentInputConfig & EventStreamSerdeInputConfig & ClientInputEndpointParameters;
135
141
  /**
136
142
  * @public
137
143
  *
@@ -142,7 +148,7 @@ export interface SageMakerRuntimeClientConfig extends SageMakerRuntimeClientConf
142
148
  /**
143
149
  * @public
144
150
  */
145
- export type SageMakerRuntimeClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig & RegionResolvedConfig & EndpointResolvedConfig<EndpointParameters> & RetryResolvedConfig & HostHeaderResolvedConfig & AwsAuthResolvedConfig & UserAgentResolvedConfig & ClientResolvedEndpointParameters;
151
+ export type SageMakerRuntimeClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig & RegionResolvedConfig & EndpointResolvedConfig<EndpointParameters> & RetryResolvedConfig & HostHeaderResolvedConfig & AwsAuthResolvedConfig & UserAgentResolvedConfig & EventStreamSerdeResolvedConfig & ClientResolvedEndpointParameters;
146
152
  /**
147
153
  * @public
148
154
  *
@@ -23,18 +23,18 @@ export interface InvokeEndpointAsyncCommandOutput extends InvokeEndpointAsyncOut
23
23
  }
24
24
  /**
25
25
  * @public
26
- * <p>After you deploy a model into production using Amazon SageMaker hosting services, your client
27
- * applications use this API to get inferences from the model hosted at the specified
28
- * endpoint in an asynchronous manner.</p>
26
+ * <p>After you deploy a model into production using Amazon SageMaker hosting services,
27
+ * your client applications use this API to get inferences from the model hosted at the
28
+ * specified endpoint in an asynchronous manner.</p>
29
29
  * <p>Inference requests sent to this API are enqueued for asynchronous processing. The
30
30
  * processing of the inference request may or may not complete before you receive a
31
31
  * response from this API. The response from this API will not contain the result of the
32
32
  * inference request but contain information about where you can locate it.</p>
33
- * <p>Amazon SageMaker strips all <code>POST</code> headers except those supported by the API. Amazon SageMaker
34
- * might add additional headers. You should not rely on the behavior of headers outside
35
- * those enumerated in the request syntax.</p>
36
- * <p>Calls to <code>InvokeEndpointAsync</code> are authenticated by using Amazon Web Services Signature Version 4. For information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">Authenticating Requests (Amazon Web Services Signature Version 4)</a> in the
37
- * <i>Amazon S3 API Reference</i>.</p>
33
+ * <p>Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add
34
+ * additional headers. You should not rely on the behavior of headers outside those
35
+ * enumerated in the request syntax. </p>
36
+ * <p>Calls to <code>InvokeEndpointAsync</code> are authenticated by using Amazon Web Services Signature Version 4. For information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">Authenticating
37
+ * Requests (Amazon Web Services Signature Version 4)</a> in the <i>Amazon S3 API Reference</i>.</p>
38
38
  * @example
39
39
  * Use a bare-bones client and the command you need to make an API call.
40
40
  * ```javascript
@@ -36,25 +36,24 @@ export interface InvokeEndpointCommandOutput extends InvokeEndpointCommandOutput
36
36
  }
37
37
  /**
38
38
  * @public
39
- * <p>After you deploy a model into production using Amazon SageMaker hosting services, your
40
- * client applications use this API to get inferences from the model hosted at the
39
+ * <p>After you deploy a model into production using Amazon SageMaker hosting services,
40
+ * your client applications use this API to get inferences from the model hosted at the
41
41
  * specified endpoint. </p>
42
42
  * <p>For an overview of Amazon SageMaker, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works.html">How It Works</a>. </p>
43
43
  * <p>Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add
44
- * additional headers. You should not rely on the behavior of headers outside those
45
- * enumerated in the request syntax. </p>
44
+ * additional headers. You should not rely on the behavior of headers outside those
45
+ * enumerated in the request syntax. </p>
46
46
  * <p>Calls to <code>InvokeEndpoint</code> are authenticated by using Amazon Web Services
47
47
  * Signature Version 4. For information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">Authenticating
48
- * Requests (Amazon Web Services Signature Version 4)</a> in the <i>Amazon S3 API
49
- * Reference</i>.</p>
48
+ * Requests (Amazon Web Services Signature Version 4)</a> in the <i>Amazon S3 API Reference</i>.</p>
50
49
  * <p>A customer's model containers must respond to requests within 60 seconds. The model
51
50
  * itself can have a maximum processing time of 60 seconds before responding to
52
51
  * invocations. If your model is going to take 50-60 seconds of processing time, the SDK
53
52
  * socket timeout should be set to be 70 seconds.</p>
54
53
  * <note>
55
54
  * <p>Endpoints are scoped to an individual account, and are not public. The URL does
56
- * not contain the account ID, but Amazon SageMaker determines the account ID from the
57
- * authentication token that is supplied by the caller.</p>
55
+ * not contain the account ID, but Amazon SageMaker determines the account ID from
56
+ * the authentication token that is supplied by the caller.</p>
58
57
  * </note>
59
58
  * @example
60
59
  * Use a bare-bones client and the command you need to make an API call.
@@ -0,0 +1,151 @@
1
+ import { EndpointParameterInstructions } from "@smithy/middleware-endpoint";
2
+ import { Command as $Command } from "@smithy/smithy-client";
3
+ import { BlobPayloadInputTypes, Handler, HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack } from "@smithy/types";
4
+ import { InvokeEndpointWithResponseStreamInput, InvokeEndpointWithResponseStreamOutput } from "../models/models_0";
5
+ import { SageMakerRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../SageMakerRuntimeClient";
6
+ /**
7
+ * @public
8
+ */
9
+ export { __MetadataBearer, $Command };
10
+ /**
11
+ * @public
12
+ */
13
+ export type InvokeEndpointWithResponseStreamCommandInputType = Omit<InvokeEndpointWithResponseStreamInput, "Body"> & {
14
+ Body: BlobPayloadInputTypes;
15
+ };
16
+ /**
17
+ * @public
18
+ *
19
+ * The input for {@link InvokeEndpointWithResponseStreamCommand}.
20
+ */
21
+ export interface InvokeEndpointWithResponseStreamCommandInput extends InvokeEndpointWithResponseStreamCommandInputType {
22
+ }
23
+ /**
24
+ * @public
25
+ *
26
+ * The output of {@link InvokeEndpointWithResponseStreamCommand}.
27
+ */
28
+ export interface InvokeEndpointWithResponseStreamCommandOutput extends InvokeEndpointWithResponseStreamOutput, __MetadataBearer {
29
+ }
30
+ /**
31
+ * @public
32
+ * <p>Invokes a model at the specified endpoint to return the inference response as a
33
+ * stream. The inference stream provides the response payload incrementally as a series of
34
+ * parts. Before you can get an inference stream, you must have access to a model that's
35
+ * deployed using Amazon SageMaker hosting services, and the container for that model
36
+ * must support inference streaming.</p>
37
+ * <p>For more information that can help you use this API, see the following sections in the
38
+ * <i>Amazon SageMaker Developer Guide</i>:</p>
39
+ * <ul>
40
+ * <li>
41
+ * <p>For information about how to add streaming support to a model, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-code-how-containe-serves-requests">How Containers Serve Requests</a>.</p>
42
+ * </li>
43
+ * <li>
44
+ * <p>For information about how to process the streaming response, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-test-endpoints.html">Invoke real-time endpoints</a>.</p>
45
+ * </li>
46
+ * </ul>
47
+ * <p>Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add
48
+ * additional headers. You should not rely on the behavior of headers outside those
49
+ * enumerated in the request syntax. </p>
50
+ * <p>Calls to <code>InvokeEndpointWithResponseStream</code> are authenticated by using
51
+ * Amazon Web Services Signature Version 4. For information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">Authenticating Requests (Amazon Web Services Signature Version 4)</a> in the
52
+ * <i>Amazon S3 API Reference</i>.</p>
53
+ * @example
54
+ * Use a bare-bones client and the command you need to make an API call.
55
+ * ```javascript
56
+ * import { SageMakerRuntimeClient, InvokeEndpointWithResponseStreamCommand } from "@aws-sdk/client-sagemaker-runtime"; // ES Modules import
57
+ * // const { SageMakerRuntimeClient, InvokeEndpointWithResponseStreamCommand } = require("@aws-sdk/client-sagemaker-runtime"); // CommonJS import
58
+ * const client = new SageMakerRuntimeClient(config);
59
+ * const input = { // InvokeEndpointWithResponseStreamInput
60
+ * EndpointName: "STRING_VALUE", // required
61
+ * Body: "BLOB_VALUE", // required
62
+ * ContentType: "STRING_VALUE",
63
+ * Accept: "STRING_VALUE",
64
+ * CustomAttributes: "STRING_VALUE",
65
+ * TargetVariant: "STRING_VALUE",
66
+ * TargetContainerHostname: "STRING_VALUE",
67
+ * InferenceId: "STRING_VALUE",
68
+ * };
69
+ * const command = new InvokeEndpointWithResponseStreamCommand(input);
70
+ * const response = await client.send(command);
71
+ * // { // InvokeEndpointWithResponseStreamOutput
72
+ * // Body: { // ResponseStream Union: only one key present
73
+ * // PayloadPart: { // PayloadPart
74
+ * // Bytes: "BLOB_VALUE",
75
+ * // },
76
+ * // ModelStreamError: { // ModelStreamError
77
+ * // Message: "STRING_VALUE",
78
+ * // ErrorCode: "STRING_VALUE",
79
+ * // },
80
+ * // InternalStreamFailure: { // InternalStreamFailure
81
+ * // Message: "STRING_VALUE",
82
+ * // },
83
+ * // },
84
+ * // ContentType: "STRING_VALUE",
85
+ * // InvokedProductionVariant: "STRING_VALUE",
86
+ * // CustomAttributes: "STRING_VALUE",
87
+ * // };
88
+ *
89
+ * ```
90
+ *
91
+ * @param InvokeEndpointWithResponseStreamCommandInput - {@link InvokeEndpointWithResponseStreamCommandInput}
92
+ * @returns {@link InvokeEndpointWithResponseStreamCommandOutput}
93
+ * @see {@link InvokeEndpointWithResponseStreamCommandInput} for command's `input` shape.
94
+ * @see {@link InvokeEndpointWithResponseStreamCommandOutput} for command's `response` shape.
95
+ * @see {@link SageMakerRuntimeClientResolvedConfig | config} for SageMakerRuntimeClient's `config` shape.
96
+ *
97
+ * @throws {@link InternalFailure} (server fault)
98
+ * <p> An internal failure occurred. </p>
99
+ *
100
+ * @throws {@link InternalStreamFailure} (server fault)
101
+ * <p>The stream processing failed because of an unknown error, exception or failure. Try your request again.</p>
102
+ *
103
+ * @throws {@link ModelError} (client fault)
104
+ * <p> Model (owned by the customer in the container) returned 4xx or 5xx error code.
105
+ * </p>
106
+ *
107
+ * @throws {@link ModelStreamError} (client fault)
108
+ * <p> An error occurred while streaming the response body. This error can have the
109
+ * following error codes:</p>
110
+ * <dl>
111
+ * <dt>ModelInvocationTimeExceeded</dt>
112
+ * <dd>
113
+ * <p>The model failed to finish sending the response within the timeout period allowed by Amazon SageMaker.</p>
114
+ * </dd>
115
+ * <dt>StreamBroken</dt>
116
+ * <dd>
117
+ * <p>The Transmission Control Protocol (TCP) connection between the client and
118
+ * the model was reset or closed.</p>
119
+ * </dd>
120
+ * </dl>
121
+ *
122
+ * @throws {@link ServiceUnavailable} (server fault)
123
+ * <p> The service is unavailable. Try your call again. </p>
124
+ *
125
+ * @throws {@link ValidationError} (client fault)
126
+ * <p> Inspect your request and try again. </p>
127
+ *
128
+ * @throws {@link SageMakerRuntimeServiceException}
129
+ * <p>Base exception class for all service exceptions from SageMakerRuntime service.</p>
130
+ *
131
+ */
132
+ export declare class InvokeEndpointWithResponseStreamCommand extends $Command<InvokeEndpointWithResponseStreamCommandInput, InvokeEndpointWithResponseStreamCommandOutput, SageMakerRuntimeClientResolvedConfig> {
133
+ readonly input: InvokeEndpointWithResponseStreamCommandInput;
134
+ static getEndpointParameterInstructions(): EndpointParameterInstructions;
135
+ /**
136
+ * @public
137
+ */
138
+ constructor(input: InvokeEndpointWithResponseStreamCommandInput);
139
+ /**
140
+ * @internal
141
+ */
142
+ resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: SageMakerRuntimeClientResolvedConfig, options?: __HttpHandlerOptions): Handler<InvokeEndpointWithResponseStreamCommandInput, InvokeEndpointWithResponseStreamCommandOutput>;
143
+ /**
144
+ * @internal
145
+ */
146
+ private serialize;
147
+ /**
148
+ * @internal
149
+ */
150
+ private deserialize;
151
+ }
@@ -1,2 +1,3 @@
1
1
  export * from "./InvokeEndpointAsyncCommand";
2
2
  export * from "./InvokeEndpointCommand";
3
+ export * from "./InvokeEndpointWithResponseStreamCommand";