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.
455 456 457 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 455 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.
1089 1090 1091 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1089 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.
1092 1093 1094 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1092 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.
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1062 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.75.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
646 647 648 649 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 646 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
758 759 760 761 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 758 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
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1035 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.
1082 1083 1084 |
# File 'lib/aws-sdk-sagemakerruntime/client.rb', line 1082 def waiter_names [] end |