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.
396 397 398 |
# File 'gems/aws-sdk-sagemakerruntime/lib/aws-sdk-sagemakerruntime/client.rb', line 396 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.
560 561 562 563 |
# File 'gems/aws-sdk-sagemakerruntime/lib/aws-sdk-sagemakerruntime/client.rb', line 560 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.
672 673 674 675 |
# File 'gems/aws-sdk-sagemakerruntime/lib/aws-sdk-sagemakerruntime/client.rb', line 672 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.
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.
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
# File 'gems/aws-sdk-sagemakerruntime/lib/aws-sdk-sagemakerruntime/client.rb', line 926 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 |