Class: Aws::SageMakerRuntime::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::SageMakerRuntime::Client
- Includes:
- ClientStubs
- Defined in:
- gems/aws-sdk-sagemakerruntime/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.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
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.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
Methods included from ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
478 479 480 |
# File 'gems/aws-sdk-sagemakerruntime/lib/aws-sdk-sagemakerruntime/client.rb', line 478 def initialize(*args) super end |
Instance Method Details
#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.
669 670 671 672 |
# File 'gems/aws-sdk-sagemakerruntime/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.
781 782 783 784 |
# File 'gems/aws-sdk-sagemakerruntime/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)
in the Amazon S3 API Reference.
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 |
# File 'gems/aws-sdk-sagemakerruntime/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 |