Class: Aws::SageMakerRuntime::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::SageMakerRuntime::Client
- Includes:
- ClientStubs
- Defined in:
- lib/aws-sdk-sagemakerruntime/client.rb
Overview
An API client for SageMakerRuntime. To construct a client, you need to configure a ‘:region` and `:credentials`.
client = Aws::SageMakerRuntime::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
See #initialize for a full list of supported configuration options.
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#invoke_endpoint(params = {}) ⇒ Types::InvokeEndpointOutput
After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint.
-
#invoke_endpoint_async(params = {}) ⇒ Types::InvokeEndpointAsyncOutput
After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint in an asynchronous manner.
-
#invoke_endpoint_with_response_stream(params = {}) ⇒ Types::InvokeEndpointWithResponseStreamOutput
Invokes a model at the specified endpoint to return the inference response as a stream.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #waiter_names ⇒ Object deprecated private Deprecated.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
478 479 480 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 478 def initialize(*args) super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1112 1113 1114 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1112 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1115 1116 1117 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1115 def errors_module Errors end |
Instance Method Details
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1085 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) tracer = config.telemetry_provider.tracer_provider.tracer( Aws::Telemetry.module_to_tracer_name('Aws::SageMakerRuntime') ) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config, tracer: tracer ) context[:gem_name] = 'aws-sdk-sagemakerruntime' context[:gem_version] = '1.79.0' Seahorse::Client::Request.new(handlers, context) end |
#invoke_endpoint(params = {}) ⇒ Types::InvokeEndpointOutput
After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint.
For an overview of Amazon SageMaker, see [How It Works].
Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.
Calls to ‘InvokeEndpoint` are authenticated by using Amazon Web Services Signature Version 4. For information, see [Authenticating Requests (Amazon Web Services Signature Version 4)] in the *Amazon S3 API Reference*.
A customer’s model containers must respond to requests within 60 seconds. The model itself can have a maximum processing time of 60 seconds before responding to invocations. If your model is going to take 50-60 seconds of processing time, the SDK socket timeout should be set to be 70 seconds.
<note markdown=“1”> Endpoints are scoped to an individual account, and are not public. The URL does not contain the account ID, but Amazon SageMaker determines the account ID from the authentication token that is supplied by the caller.
</note>
[1]: docs.aws.amazon.com/sagemaker/latest/dg/how-it-works.html [2]: docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
669 670 671 672 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 669 def invoke_endpoint(params = {}, = {}) req = build_request(:invoke_endpoint, params) req.send_request() end |
#invoke_endpoint_async(params = {}) ⇒ Types::InvokeEndpointAsyncOutput
After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint in an asynchronous manner.
Inference requests sent to this API are enqueued for asynchronous processing. The processing of the inference request may or may not complete before you receive a response from this API. The response from this API will not contain the result of the inference request but contain information about where you can locate it.
Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.
Calls to ‘InvokeEndpointAsync` are authenticated by using Amazon Web Services Signature Version 4. For information, see [Authenticating Requests (Amazon Web Services Signature Version 4)] in the *Amazon S3 API Reference*.
[1]: docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
781 782 783 784 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 781 def invoke_endpoint_async(params = {}, = {}) req = build_request(:invoke_endpoint_async, params) req.send_request() end |
#invoke_endpoint_with_response_stream(params = {}) ⇒ Types::InvokeEndpointWithResponseStreamOutput
Invokes a model at the specified endpoint to return the inference response as a stream. The inference stream provides the response payload incrementally as a series of parts. Before you can get an inference stream, you must have access to a model that’s deployed using Amazon SageMaker hosting services, and the container for that model must support inference streaming.
For more information that can help you use this API, see the following sections in the *Amazon SageMaker Developer Guide*:
-
For information about how to add streaming support to a model, see [How Containers Serve Requests].
-
For information about how to process the streaming response, see [Invoke real-time endpoints].
Before you can use this operation, your IAM permissions must allow the ‘sagemaker:InvokeEndpoint` action. For more information about Amazon SageMaker actions for IAM policies, see [Actions, resources, and condition keys for Amazon SageMaker] in the *IAM Service Authorization Reference*.
Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.
Calls to ‘InvokeEndpointWithResponseStream` are authenticated by using Amazon Web Services Signature Version 4. For information, see
- Authenticating Requests (Amazon Web Services Signature Version 4)][4
-
in the *Amazon S3 API Reference*.
[1]: docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-code-how-containe-serves-requests [2]: docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-test-endpoints.html [3]: docs.aws.amazon.com/service-authorization/latest/reference/list_amazonsagemaker.html [4]: docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1058 def invoke_endpoint_with_response_stream(params = {}, = {}, &block) params = params.dup event_stream_handler = case handler = params.delete(:event_stream_handler) when EventStreams::ResponseStream then handler when Proc then EventStreams::ResponseStream.new.tap(&handler) when nil then EventStreams::ResponseStream.new else msg = "expected :event_stream_handler to be a block or "\ "instance of Aws::SageMakerRuntime::EventStreams::ResponseStream"\ ", got `#{handler.inspect}` instead" raise ArgumentError, msg end yield(event_stream_handler) if block_given? req = build_request(:invoke_endpoint_with_response_stream, params) req.context[:event_stream_handler] = event_stream_handler req.handlers.add(Aws::Binary::DecodeHandler, priority: 95) req.send_request(, &block) end |
#waiter_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1105 1106 1107 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1105 def waiter_names [] end |