Skip to content

Commit 0e02d0a

Browse files
author
awstools
committed
feat(client-sagemaker-runtime): This release adds InferenceComponentName to InvokeEndpoint and InvokeEndpointWithResponseStream APIs to get inferences from the deployed InferenceComponents.
1 parent a8ae1e9 commit 0e02d0a

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

clients/client-sagemaker-runtime/src/commands/InvokeEndpointCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export interface InvokeEndpointCommandOutput extends InvokeEndpointCommandOutput
9494
* TargetContainerHostname: "STRING_VALUE",
9595
* InferenceId: "STRING_VALUE",
9696
* EnableExplanations: "STRING_VALUE",
97+
* InferenceComponentName: "STRING_VALUE",
9798
* };
9899
* const command = new InvokeEndpointCommand(input);
99100
* const response = await client.send(command);

clients/client-sagemaker-runtime/src/commands/InvokeEndpointWithResponseStreamCommand.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ export interface InvokeEndpointWithResponseStreamCommandOutput
7272
* <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>
7373
* </li>
7474
* </ul>
75+
* <p>Before you can use this operation, your IAM permissions must allow the
76+
* <code>sagemaker:InvokeEndpoint</code> action. For more information about Amazon SageMaker actions for IAM policies, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonsagemaker.html">Actions, resources, and condition keys for Amazon SageMaker</a> in the <i>IAM Service Authorization
77+
* Reference</i>.</p>
7578
* <p>Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add
7679
* additional headers. You should not rely on the behavior of headers outside those
7780
* enumerated in the request syntax. </p>
@@ -93,6 +96,7 @@ export interface InvokeEndpointWithResponseStreamCommandOutput
9396
* TargetVariant: "STRING_VALUE",
9497
* TargetContainerHostname: "STRING_VALUE",
9598
* InferenceId: "STRING_VALUE",
99+
* InferenceComponentName: "STRING_VALUE",
96100
* };
97101
* const command = new InvokeEndpointWithResponseStreamCommand(input);
98102
* const response = await client.send(command);

clients/client-sagemaker-runtime/src/models/models_0.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ export interface InvokeEndpointInput {
139139
* </p>
140140
*/
141141
EnableExplanations?: string;
142+
143+
/**
144+
* @public
145+
* <p>If the endpoint hosts one or more inference components, this parameter specifies the
146+
* name of inference component to invoke.</p>
147+
*/
148+
InferenceComponentName?: string;
142149
}
143150

144151
/**
@@ -494,6 +501,13 @@ export interface InvokeEndpointWithResponseStreamInput {
494501
* <p>An identifier that you assign to your request.</p>
495502
*/
496503
InferenceId?: string;
504+
505+
/**
506+
* @public
507+
* <p>If the endpoint hosts one or more inference components, this parameter specifies the
508+
* name of inference component to invoke for a streaming response.</p>
509+
*/
510+
InferenceComponentName?: string;
497511
}
498512

499513
/**

clients/client-sagemaker-runtime/src/protocols/Aws_restJson1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const se_InvokeEndpointCommand = async (
6060
"x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname!,
6161
"x-amzn-sagemaker-inference-id": input.InferenceId!,
6262
"x-amzn-sagemaker-enable-explanations": input.EnableExplanations!,
63+
"x-amzn-sagemaker-inference-component": input.InferenceComponentName!,
6364
});
6465
let resolvedPath =
6566
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/endpoints/{EndpointName}/invocations";
@@ -147,6 +148,7 @@ export const se_InvokeEndpointWithResponseStreamCommand = async (
147148
"x-amzn-sagemaker-target-variant": input.TargetVariant!,
148149
"x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname!,
149150
"x-amzn-sagemaker-inference-id": input.InferenceId!,
151+
"x-amzn-sagemaker-inference-component": input.InferenceComponentName!,
150152
});
151153
let resolvedPath =
152154
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +

codegen/sdk-codegen/aws-models/sagemaker-runtime.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,16 @@
11301130
"smithy.api#pattern": "^\\p{ASCII}*$"
11311131
}
11321132
},
1133+
"com.amazonaws.sagemakerruntime#InferenceComponentHeader": {
1134+
"type": "string",
1135+
"traits": {
1136+
"smithy.api#length": {
1137+
"min": 0,
1138+
"max": 63
1139+
},
1140+
"smithy.api#pattern": "^[a-zA-Z0-9]([\\-a-zA-Z0-9]*[a-zA-Z0-9])?$"
1141+
}
1142+
},
11331143
"com.amazonaws.sagemakerruntime#InferenceId": {
11341144
"type": "string",
11351145
"traits": {
@@ -1432,6 +1442,13 @@
14321442
"smithy.api#documentation": "<p>An optional JMESPath expression used to override the <code>EnableExplanations</code>\n parameter of the <code>ClarifyExplainerConfig</code> API. See the <a href=\"https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-create-endpoint.html#clarify-online-explainability-create-endpoint-enable\">EnableExplanations</a> section in the developer guide for more information.\n </p>",
14331443
"smithy.api#httpHeader": "X-Amzn-SageMaker-Enable-Explanations"
14341444
}
1445+
},
1446+
"InferenceComponentName": {
1447+
"target": "com.amazonaws.sagemakerruntime#InferenceComponentHeader",
1448+
"traits": {
1449+
"smithy.api#documentation": "<p>If the endpoint hosts one or more inference components, this parameter specifies the\n name of inference component to invoke.</p>",
1450+
"smithy.api#httpHeader": "X-Amzn-SageMaker-Inference-Component"
1451+
}
14351452
}
14361453
},
14371454
"traits": {
@@ -1505,7 +1522,7 @@
15051522
}
15061523
],
15071524
"traits": {
1508-
"smithy.api#documentation": "<p>Invokes a model at the specified endpoint to return the inference response as a\n stream. The inference stream provides the response payload incrementally as a series of\n parts. Before you can get an inference stream, you must have access to a model that's\n deployed using Amazon SageMaker hosting services, and the container for that model\n must support inference streaming.</p>\n <p>For more information that can help you use this API, see the following sections in the\n <i>Amazon SageMaker Developer Guide</i>:</p>\n <ul>\n <li>\n <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>\n </li>\n <li>\n <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>\n </li>\n </ul>\n <p>Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add\n additional headers. You should not rely on the behavior of headers outside those\n enumerated in the request syntax. </p>\n <p>Calls to <code>InvokeEndpointWithResponseStream</code> are authenticated by using\n 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\n <i>Amazon S3 API Reference</i>.</p>",
1525+
"smithy.api#documentation": "<p>Invokes a model at the specified endpoint to return the inference response as a\n stream. The inference stream provides the response payload incrementally as a series of\n parts. Before you can get an inference stream, you must have access to a model that's\n deployed using Amazon SageMaker hosting services, and the container for that model\n must support inference streaming.</p>\n <p>For more information that can help you use this API, see the following sections in the\n <i>Amazon SageMaker Developer Guide</i>:</p>\n <ul>\n <li>\n <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>\n </li>\n <li>\n <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>\n </li>\n </ul>\n <p>Before you can use this operation, your IAM permissions must allow the\n <code>sagemaker:InvokeEndpoint</code> action. For more information about Amazon SageMaker actions for IAM policies, see <a href=\"https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonsagemaker.html\">Actions, resources, and condition keys for Amazon SageMaker</a> in the <i>IAM Service Authorization\n Reference</i>.</p>\n <p>Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add\n additional headers. You should not rely on the behavior of headers outside those\n enumerated in the request syntax. </p>\n <p>Calls to <code>InvokeEndpointWithResponseStream</code> are authenticated by using\n 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\n <i>Amazon S3 API Reference</i>.</p>",
15091526
"smithy.api#http": {
15101527
"method": "POST",
15111528
"uri": "/endpoints/{EndpointName}/invocations-response-stream",
@@ -1574,6 +1591,13 @@
15741591
"smithy.api#documentation": "<p>An identifier that you assign to your request.</p>",
15751592
"smithy.api#httpHeader": "X-Amzn-SageMaker-Inference-Id"
15761593
}
1594+
},
1595+
"InferenceComponentName": {
1596+
"target": "com.amazonaws.sagemakerruntime#InferenceComponentHeader",
1597+
"traits": {
1598+
"smithy.api#documentation": "<p>If the endpoint hosts one or more inference components, this parameter specifies the\n name of inference component to invoke for a streaming response.</p>",
1599+
"smithy.api#httpHeader": "X-Amzn-SageMaker-Inference-Component"
1600+
}
15771601
}
15781602
},
15791603
"traits": {

0 commit comments

Comments
 (0)