aws-sdk-sagemakerruntime 1.54.0 → 1.56.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-sagemakerruntime/client.rb +294 -9
- data/lib/aws-sdk-sagemakerruntime/client_api.rb +57 -0
- data/lib/aws-sdk-sagemakerruntime/endpoints.rb +14 -0
- data/lib/aws-sdk-sagemakerruntime/errors.rb +37 -0
- data/lib/aws-sdk-sagemakerruntime/event_streams.rb +59 -0
- data/lib/aws-sdk-sagemakerruntime/plugins/endpoints.rb +2 -0
- data/lib/aws-sdk-sagemakerruntime/types.rb +247 -7
- data/lib/aws-sdk-sagemakerruntime.rb +2 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69c3165f42413efed12d84d750651ff552988f08644a9017ca730a704b161fc8
|
4
|
+
data.tar.gz: 54cdac76d78ebf92c584aa256c0eb709813dfab164a57aaf6933347dbdd39100
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9202ac77cab11e6ef4b0134fae4c5a059a406adde5d596da6eccec4f5f5dec9fde70e7fe59733e863b3933ecdbe9f317ab3852038d93d88a92ba785fdd325d0e
|
7
|
+
data.tar.gz: ab5dd093eeadc255912c18932e0d5147101c297e016c89701d283bb08f8878535b6c1f03b9d6e9c6abc02a1d97d66abbdccf3849fade07531f6718fee1c37922
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
1.56.0 (2023-09-27)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
|
8
|
+
|
9
|
+
1.55.0 (2023-08-31)
|
10
|
+
------------------
|
11
|
+
|
12
|
+
* Feature - This release adds a new InvokeEndpointWithResponseStream API to support streaming of model responses.
|
13
|
+
|
4
14
|
1.54.0 (2023-07-11)
|
5
15
|
------------------
|
6
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.56.0
|
@@ -33,6 +33,7 @@ require 'aws-sdk-core/plugins/defaults_mode.rb'
|
|
33
33
|
require 'aws-sdk-core/plugins/recursion_detection.rb'
|
34
34
|
require 'aws-sdk-core/plugins/sign.rb'
|
35
35
|
require 'aws-sdk-core/plugins/protocols/rest_json.rb'
|
36
|
+
require 'aws-sdk-core/plugins/event_stream_configuration.rb'
|
36
37
|
|
37
38
|
Aws::Plugins::GlobalConfiguration.add_identifier(:sagemakerruntime)
|
38
39
|
|
@@ -83,6 +84,7 @@ module Aws::SageMakerRuntime
|
|
83
84
|
add_plugin(Aws::Plugins::RecursionDetection)
|
84
85
|
add_plugin(Aws::Plugins::Sign)
|
85
86
|
add_plugin(Aws::Plugins::Protocols::RestJson)
|
87
|
+
add_plugin(Aws::Plugins::EventStreamConfiguration)
|
86
88
|
add_plugin(Aws::SageMakerRuntime::Plugins::Endpoints)
|
87
89
|
|
88
90
|
# @overload initialize(options)
|
@@ -216,10 +218,16 @@ module Aws::SageMakerRuntime
|
|
216
218
|
# @option options [Boolean] :endpoint_discovery (false)
|
217
219
|
# When set to `true`, endpoint discovery will be enabled for operations when available.
|
218
220
|
#
|
221
|
+
# @option options [Proc] :event_stream_handler
|
222
|
+
# When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
223
|
+
#
|
219
224
|
# @option options [Boolean] :ignore_configured_endpoint_urls
|
220
225
|
# Setting to true disables use of endpoint URLs provided via environment
|
221
226
|
# variables and the shared configuration file.
|
222
227
|
#
|
228
|
+
# @option options [Proc] :input_event_stream_handler
|
229
|
+
# When an EventStream or Proc object is provided, it can be used for sending events for the event stream.
|
230
|
+
#
|
223
231
|
# @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
|
224
232
|
# The log formatter.
|
225
233
|
#
|
@@ -236,6 +244,9 @@ module Aws::SageMakerRuntime
|
|
236
244
|
# setting this value to 5 will result in a request being retried up to
|
237
245
|
# 4 times. Used in `standard` and `adaptive` retry modes.
|
238
246
|
#
|
247
|
+
# @option options [Proc] :output_event_stream_handler
|
248
|
+
# When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
249
|
+
#
|
239
250
|
# @option options [String] :profile ("default")
|
240
251
|
# Used when loading credentials from the shared credentials file
|
241
252
|
# at HOME/.aws/credentials. When not specified, 'default' is used.
|
@@ -446,7 +457,8 @@ module Aws::SageMakerRuntime
|
|
446
457
|
# The MIME type of the input data in the request body.
|
447
458
|
#
|
448
459
|
# @option params [String] :accept
|
449
|
-
# The desired MIME type of the inference
|
460
|
+
# The desired MIME type of the inference response from the model
|
461
|
+
# container.
|
450
462
|
#
|
451
463
|
# @option params [String] :custom_attributes
|
452
464
|
# Provides additional information about a request for an inference
|
@@ -469,7 +481,7 @@ module Aws::SageMakerRuntime
|
|
469
481
|
#
|
470
482
|
#
|
471
483
|
#
|
472
|
-
# [1]: https://
|
484
|
+
# [1]: https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
|
473
485
|
#
|
474
486
|
# @option params [String] :target_model
|
475
487
|
# The model to request for inference when invoking a multi-model
|
@@ -561,8 +573,8 @@ module Aws::SageMakerRuntime
|
|
561
573
|
# from this API will not contain the result of the inference request but
|
562
574
|
# contain information about where you can locate it.
|
563
575
|
#
|
564
|
-
# Amazon SageMaker strips all
|
565
|
-
#
|
576
|
+
# Amazon SageMaker strips all POST headers except those supported by the
|
577
|
+
# API. Amazon SageMaker might add additional headers. You should not
|
566
578
|
# rely on the behavior of headers outside those enumerated in the
|
567
579
|
# request syntax.
|
568
580
|
#
|
@@ -577,17 +589,18 @@ module Aws::SageMakerRuntime
|
|
577
589
|
#
|
578
590
|
# @option params [required, String] :endpoint_name
|
579
591
|
# The name of the endpoint that you specified when you created the
|
580
|
-
# endpoint using the [
|
592
|
+
# endpoint using the [CreateEndpoint][1] API.
|
581
593
|
#
|
582
594
|
#
|
583
595
|
#
|
584
|
-
# [1]: https://docs.aws.amazon.com/sagemaker/latest/
|
596
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html
|
585
597
|
#
|
586
598
|
# @option params [String] :content_type
|
587
599
|
# The MIME type of the input data in the request body.
|
588
600
|
#
|
589
601
|
# @option params [String] :accept
|
590
|
-
# The desired MIME type of the inference
|
602
|
+
# The desired MIME type of the inference response from the model
|
603
|
+
# container.
|
591
604
|
#
|
592
605
|
# @option params [String] :custom_attributes
|
593
606
|
# Provides additional information about a request for an inference
|
@@ -603,7 +616,7 @@ module Aws::SageMakerRuntime
|
|
603
616
|
# custom attributes in the response. If your code does not set this
|
604
617
|
# value in the response, an empty value is returned. For example, if a
|
605
618
|
# custom attribute represents the trace ID, your model can prepend the
|
606
|
-
# custom attribute with `Trace ID
|
619
|
+
# custom attribute with `Trace ID:` in your post-processing function.
|
607
620
|
#
|
608
621
|
# This feature is currently supported in the Amazon Web Services SDKs
|
609
622
|
# but not in the Amazon SageMaker Python SDK.
|
@@ -661,6 +674,278 @@ module Aws::SageMakerRuntime
|
|
661
674
|
req.send_request(options)
|
662
675
|
end
|
663
676
|
|
677
|
+
# Invokes a model at the specified endpoint to return the inference
|
678
|
+
# response as a stream. The inference stream provides the response
|
679
|
+
# payload incrementally as a series of parts. Before you can get an
|
680
|
+
# inference stream, you must have access to a model that's deployed
|
681
|
+
# using Amazon SageMaker hosting services, and the container for that
|
682
|
+
# model must support inference streaming.
|
683
|
+
#
|
684
|
+
# For more information that can help you use this API, see the following
|
685
|
+
# sections in the *Amazon SageMaker Developer Guide*:
|
686
|
+
#
|
687
|
+
# * For information about how to add streaming support to a model, see
|
688
|
+
# [How Containers Serve Requests][1].
|
689
|
+
#
|
690
|
+
# * For information about how to process the streaming response, see
|
691
|
+
# [Invoke real-time endpoints][2].
|
692
|
+
#
|
693
|
+
# Amazon SageMaker strips all POST headers except those supported by the
|
694
|
+
# API. Amazon SageMaker might add additional headers. You should not
|
695
|
+
# rely on the behavior of headers outside those enumerated in the
|
696
|
+
# request syntax.
|
697
|
+
#
|
698
|
+
# Calls to `InvokeEndpointWithResponseStream` are authenticated by using
|
699
|
+
# Amazon Web Services Signature Version 4. For information, see
|
700
|
+
# [Authenticating Requests (Amazon Web Services Signature Version 4)][3]
|
701
|
+
# in the *Amazon S3 API Reference*.
|
702
|
+
#
|
703
|
+
#
|
704
|
+
#
|
705
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-code-how-containe-serves-requests
|
706
|
+
# [2]: https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-test-endpoints.html
|
707
|
+
# [3]: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
|
708
|
+
#
|
709
|
+
# @option params [required, String] :endpoint_name
|
710
|
+
# The name of the endpoint that you specified when you created the
|
711
|
+
# endpoint using the [CreateEndpoint][1] API.
|
712
|
+
#
|
713
|
+
#
|
714
|
+
#
|
715
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html
|
716
|
+
#
|
717
|
+
# @option params [required, String, StringIO, File] :body
|
718
|
+
# Provides input data, in the format specified in the `ContentType`
|
719
|
+
# request header. Amazon SageMaker passes all of the data in the body to
|
720
|
+
# the model.
|
721
|
+
#
|
722
|
+
# For information about the format of the request body, see [Common Data
|
723
|
+
# Formats-Inference][1].
|
724
|
+
#
|
725
|
+
#
|
726
|
+
#
|
727
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html
|
728
|
+
#
|
729
|
+
# @option params [String] :content_type
|
730
|
+
# The MIME type of the input data in the request body.
|
731
|
+
#
|
732
|
+
# @option params [String] :accept
|
733
|
+
# The desired MIME type of the inference response from the model
|
734
|
+
# container.
|
735
|
+
#
|
736
|
+
# @option params [String] :custom_attributes
|
737
|
+
# Provides additional information about a request for an inference
|
738
|
+
# submitted to a model hosted at an Amazon SageMaker endpoint. The
|
739
|
+
# information is an opaque value that is forwarded verbatim. You could
|
740
|
+
# use this value, for example, to provide an ID that you can use to
|
741
|
+
# track a request or to provide other metadata that a service endpoint
|
742
|
+
# was programmed to process. The value must consist of no more than 1024
|
743
|
+
# visible US-ASCII characters as specified in [Section 3.3.6. Field
|
744
|
+
# Value Components][1] of the Hypertext Transfer Protocol (HTTP/1.1).
|
745
|
+
#
|
746
|
+
# The code in your model is responsible for setting or updating any
|
747
|
+
# custom attributes in the response. If your code does not set this
|
748
|
+
# value in the response, an empty value is returned. For example, if a
|
749
|
+
# custom attribute represents the trace ID, your model can prepend the
|
750
|
+
# custom attribute with `Trace ID:` in your post-processing function.
|
751
|
+
#
|
752
|
+
# This feature is currently supported in the Amazon Web Services SDKs
|
753
|
+
# but not in the Amazon SageMaker Python SDK.
|
754
|
+
#
|
755
|
+
#
|
756
|
+
#
|
757
|
+
# [1]: https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
|
758
|
+
#
|
759
|
+
# @option params [String] :target_variant
|
760
|
+
# Specify the production variant to send the inference request to when
|
761
|
+
# invoking an endpoint that is running two or more variants. Note that
|
762
|
+
# this parameter overrides the default behavior for the endpoint, which
|
763
|
+
# is to distribute the invocation traffic based on the variant weights.
|
764
|
+
#
|
765
|
+
# For information about how to use variant targeting to perform a/b
|
766
|
+
# testing, see [Test models in production][1]
|
767
|
+
#
|
768
|
+
#
|
769
|
+
#
|
770
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/model-ab-testing.html
|
771
|
+
#
|
772
|
+
# @option params [String] :target_container_hostname
|
773
|
+
# If the endpoint hosts multiple containers and is configured to use
|
774
|
+
# direct invocation, this parameter specifies the host name of the
|
775
|
+
# container to invoke.
|
776
|
+
#
|
777
|
+
# @option params [String] :inference_id
|
778
|
+
# An identifier that you assign to your request.
|
779
|
+
#
|
780
|
+
# @return [Types::InvokeEndpointWithResponseStreamOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
781
|
+
#
|
782
|
+
# * {Types::InvokeEndpointWithResponseStreamOutput#body #body} => Types::ResponseStream
|
783
|
+
# * {Types::InvokeEndpointWithResponseStreamOutput#content_type #content_type} => String
|
784
|
+
# * {Types::InvokeEndpointWithResponseStreamOutput#invoked_production_variant #invoked_production_variant} => String
|
785
|
+
# * {Types::InvokeEndpointWithResponseStreamOutput#custom_attributes #custom_attributes} => String
|
786
|
+
#
|
787
|
+
# @example EventStream Operation Example
|
788
|
+
#
|
789
|
+
# You can process event once it arrives immediately, or wait until
|
790
|
+
# full response complete and iterate through eventstream enumerator.
|
791
|
+
#
|
792
|
+
# To interact with event immediately, you need to register #invoke_endpoint_with_response_stream
|
793
|
+
# with callbacks, callbacks can be register for specifc events or for all events,
|
794
|
+
# callback for errors in the event stream is also available for register.
|
795
|
+
#
|
796
|
+
# Callbacks can be passed in by `:event_stream_handler` option or within block
|
797
|
+
# statement attached to #invoke_endpoint_with_response_stream call directly. Hybrid pattern of both
|
798
|
+
# is also supported.
|
799
|
+
#
|
800
|
+
# `:event_stream_handler` option takes in either Proc object or
|
801
|
+
# Aws::SageMakerRuntime::EventStreams::ResponseStream object.
|
802
|
+
#
|
803
|
+
# Usage pattern a): callbacks with a block attached to #invoke_endpoint_with_response_stream
|
804
|
+
# Example for registering callbacks for all event types and error event
|
805
|
+
#
|
806
|
+
# client.invoke_endpoint_with_response_stream( # params input# ) do |stream|
|
807
|
+
# stream.on_error_event do |event|
|
808
|
+
# # catch unmodeled error event in the stream
|
809
|
+
# raise event
|
810
|
+
# # => Aws::Errors::EventError
|
811
|
+
# # event.event_type => :error
|
812
|
+
# # event.error_code => String
|
813
|
+
# # event.error_message => String
|
814
|
+
# end
|
815
|
+
#
|
816
|
+
# stream.on_event do |event|
|
817
|
+
# # process all events arrive
|
818
|
+
# puts event.event_type
|
819
|
+
# ...
|
820
|
+
# end
|
821
|
+
#
|
822
|
+
# end
|
823
|
+
#
|
824
|
+
# Usage pattern b): pass in `:event_stream_handler` for #invoke_endpoint_with_response_stream
|
825
|
+
#
|
826
|
+
# 1) create a Aws::SageMakerRuntime::EventStreams::ResponseStream object
|
827
|
+
# Example for registering callbacks with specific events
|
828
|
+
#
|
829
|
+
# handler = Aws::SageMakerRuntime::EventStreams::ResponseStream.new
|
830
|
+
# handler.on_payload_part_event do |event|
|
831
|
+
# event # => Aws::SageMakerRuntime::Types::PayloadPart
|
832
|
+
# end
|
833
|
+
# handler.on_model_stream_error_event do |event|
|
834
|
+
# event # => Aws::SageMakerRuntime::Types::ModelStreamError
|
835
|
+
# end
|
836
|
+
# handler.on_internal_stream_failure_event do |event|
|
837
|
+
# event # => Aws::SageMakerRuntime::Types::InternalStreamFailure
|
838
|
+
# end
|
839
|
+
#
|
840
|
+
# client.invoke_endpoint_with_response_stream( # params input #, event_stream_handler: handler)
|
841
|
+
#
|
842
|
+
# 2) use a Ruby Proc object
|
843
|
+
# Example for registering callbacks with specific events
|
844
|
+
#
|
845
|
+
# handler = Proc.new do |stream|
|
846
|
+
# stream.on_payload_part_event do |event|
|
847
|
+
# event # => Aws::SageMakerRuntime::Types::PayloadPart
|
848
|
+
# end
|
849
|
+
# stream.on_model_stream_error_event do |event|
|
850
|
+
# event # => Aws::SageMakerRuntime::Types::ModelStreamError
|
851
|
+
# end
|
852
|
+
# stream.on_internal_stream_failure_event do |event|
|
853
|
+
# event # => Aws::SageMakerRuntime::Types::InternalStreamFailure
|
854
|
+
# end
|
855
|
+
# end
|
856
|
+
#
|
857
|
+
# client.invoke_endpoint_with_response_stream( # params input #, event_stream_handler: handler)
|
858
|
+
#
|
859
|
+
# Usage pattern c): hybird pattern of a) and b)
|
860
|
+
#
|
861
|
+
# handler = Aws::SageMakerRuntime::EventStreams::ResponseStream.new
|
862
|
+
# handler.on_payload_part_event do |event|
|
863
|
+
# event # => Aws::SageMakerRuntime::Types::PayloadPart
|
864
|
+
# end
|
865
|
+
# handler.on_model_stream_error_event do |event|
|
866
|
+
# event # => Aws::SageMakerRuntime::Types::ModelStreamError
|
867
|
+
# end
|
868
|
+
# handler.on_internal_stream_failure_event do |event|
|
869
|
+
# event # => Aws::SageMakerRuntime::Types::InternalStreamFailure
|
870
|
+
# end
|
871
|
+
#
|
872
|
+
# client.invoke_endpoint_with_response_stream( # params input #, event_stream_handler: handler) do |stream|
|
873
|
+
# stream.on_error_event do |event|
|
874
|
+
# # catch unmodeled error event in the stream
|
875
|
+
# raise event
|
876
|
+
# # => Aws::Errors::EventError
|
877
|
+
# # event.event_type => :error
|
878
|
+
# # event.error_code => String
|
879
|
+
# # event.error_message => String
|
880
|
+
# end
|
881
|
+
# end
|
882
|
+
#
|
883
|
+
# Besides above usage patterns for process events when they arrive immediately, you can also
|
884
|
+
# iterate through events after response complete.
|
885
|
+
#
|
886
|
+
# Events are available at resp.body # => Enumerator
|
887
|
+
# For parameter input example, please refer to following request syntax
|
888
|
+
#
|
889
|
+
# @example Request syntax with placeholder values
|
890
|
+
#
|
891
|
+
# resp = client.invoke_endpoint_with_response_stream({
|
892
|
+
# endpoint_name: "EndpointName", # required
|
893
|
+
# body: "data", # required
|
894
|
+
# content_type: "Header",
|
895
|
+
# accept: "Header",
|
896
|
+
# custom_attributes: "CustomAttributesHeader",
|
897
|
+
# target_variant: "TargetVariantHeader",
|
898
|
+
# target_container_hostname: "TargetContainerHostnameHeader",
|
899
|
+
# inference_id: "InferenceId",
|
900
|
+
# })
|
901
|
+
#
|
902
|
+
# @example Response structure
|
903
|
+
#
|
904
|
+
# All events are available at resp.body:
|
905
|
+
# resp.body #=> Enumerator
|
906
|
+
# resp.body.event_types #=> [:payload_part, :model_stream_error, :internal_stream_failure]
|
907
|
+
#
|
908
|
+
# For :payload_part event available at #on_payload_part_event callback and response eventstream enumerator:
|
909
|
+
# event.bytes #=> String
|
910
|
+
#
|
911
|
+
# For :model_stream_error event available at #on_model_stream_error_event callback and response eventstream enumerator:
|
912
|
+
# event.message #=> String
|
913
|
+
# event.error_code #=> String
|
914
|
+
#
|
915
|
+
# For :internal_stream_failure event available at #on_internal_stream_failure_event callback and response eventstream enumerator:
|
916
|
+
# event.message #=> String
|
917
|
+
#
|
918
|
+
# resp.content_type #=> String
|
919
|
+
# resp.invoked_production_variant #=> String
|
920
|
+
# resp.custom_attributes #=> String
|
921
|
+
#
|
922
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InvokeEndpointWithResponseStream AWS API Documentation
|
923
|
+
#
|
924
|
+
# @overload invoke_endpoint_with_response_stream(params = {})
|
925
|
+
# @param [Hash] params ({})
|
926
|
+
def invoke_endpoint_with_response_stream(params = {}, options = {}, &block)
|
927
|
+
params = params.dup
|
928
|
+
event_stream_handler = case handler = params.delete(:event_stream_handler)
|
929
|
+
when EventStreams::ResponseStream then handler
|
930
|
+
when Proc then EventStreams::ResponseStream.new.tap(&handler)
|
931
|
+
when nil then EventStreams::ResponseStream.new
|
932
|
+
else
|
933
|
+
msg = "expected :event_stream_handler to be a block or "\
|
934
|
+
"instance of Aws::SageMakerRuntime::EventStreams::ResponseStream"\
|
935
|
+
", got `#{handler.inspect}` instead"
|
936
|
+
raise ArgumentError, msg
|
937
|
+
end
|
938
|
+
|
939
|
+
yield(event_stream_handler) if block_given?
|
940
|
+
|
941
|
+
req = build_request(:invoke_endpoint_with_response_stream, params)
|
942
|
+
|
943
|
+
req.context[:event_stream_handler] = event_stream_handler
|
944
|
+
req.handlers.add(Aws::Binary::DecodeHandler, priority: 95)
|
945
|
+
|
946
|
+
req.send_request(options, &block)
|
947
|
+
end
|
948
|
+
|
664
949
|
# @!endgroup
|
665
950
|
|
666
951
|
# @param params ({})
|
@@ -674,7 +959,7 @@ module Aws::SageMakerRuntime
|
|
674
959
|
params: params,
|
675
960
|
config: config)
|
676
961
|
context[:gem_name] = 'aws-sdk-sagemakerruntime'
|
677
|
-
context[:gem_version] = '1.
|
962
|
+
context[:gem_version] = '1.56.0'
|
678
963
|
Seahorse::Client::Request.new(handlers, context)
|
679
964
|
end
|
680
965
|
|
@@ -17,21 +17,29 @@ module Aws::SageMakerRuntime
|
|
17
17
|
CustomAttributesHeader = Shapes::StringShape.new(name: 'CustomAttributesHeader')
|
18
18
|
EnableExplanationsHeader = Shapes::StringShape.new(name: 'EnableExplanationsHeader')
|
19
19
|
EndpointName = Shapes::StringShape.new(name: 'EndpointName')
|
20
|
+
ErrorCode = Shapes::StringShape.new(name: 'ErrorCode')
|
20
21
|
Header = Shapes::StringShape.new(name: 'Header')
|
21
22
|
InferenceId = Shapes::StringShape.new(name: 'InferenceId')
|
22
23
|
InputLocationHeader = Shapes::StringShape.new(name: 'InputLocationHeader')
|
23
24
|
InternalDependencyException = Shapes::StructureShape.new(name: 'InternalDependencyException')
|
24
25
|
InternalFailure = Shapes::StructureShape.new(name: 'InternalFailure')
|
26
|
+
InternalStreamFailure = Shapes::StructureShape.new(name: 'InternalStreamFailure')
|
25
27
|
InvocationTimeoutSecondsHeader = Shapes::IntegerShape.new(name: 'InvocationTimeoutSecondsHeader')
|
26
28
|
InvokeEndpointAsyncInput = Shapes::StructureShape.new(name: 'InvokeEndpointAsyncInput')
|
27
29
|
InvokeEndpointAsyncOutput = Shapes::StructureShape.new(name: 'InvokeEndpointAsyncOutput')
|
28
30
|
InvokeEndpointInput = Shapes::StructureShape.new(name: 'InvokeEndpointInput')
|
29
31
|
InvokeEndpointOutput = Shapes::StructureShape.new(name: 'InvokeEndpointOutput')
|
32
|
+
InvokeEndpointWithResponseStreamInput = Shapes::StructureShape.new(name: 'InvokeEndpointWithResponseStreamInput')
|
33
|
+
InvokeEndpointWithResponseStreamOutput = Shapes::StructureShape.new(name: 'InvokeEndpointWithResponseStreamOutput')
|
30
34
|
LogStreamArn = Shapes::StringShape.new(name: 'LogStreamArn')
|
31
35
|
Message = Shapes::StringShape.new(name: 'Message')
|
32
36
|
ModelError = Shapes::StructureShape.new(name: 'ModelError')
|
33
37
|
ModelNotReadyException = Shapes::StructureShape.new(name: 'ModelNotReadyException')
|
38
|
+
ModelStreamError = Shapes::StructureShape.new(name: 'ModelStreamError')
|
39
|
+
PartBlob = Shapes::BlobShape.new(name: 'PartBlob')
|
40
|
+
PayloadPart = Shapes::StructureShape.new(name: 'PayloadPart')
|
34
41
|
RequestTTLSecondsHeader = Shapes::IntegerShape.new(name: 'RequestTTLSecondsHeader')
|
42
|
+
ResponseStream = Shapes::StructureShape.new(name: 'ResponseStream')
|
35
43
|
ServiceUnavailable = Shapes::StructureShape.new(name: 'ServiceUnavailable')
|
36
44
|
StatusCode = Shapes::IntegerShape.new(name: 'StatusCode')
|
37
45
|
TargetContainerHostnameHeader = Shapes::StringShape.new(name: 'TargetContainerHostnameHeader')
|
@@ -45,6 +53,9 @@ module Aws::SageMakerRuntime
|
|
45
53
|
InternalFailure.add_member(:message, Shapes::ShapeRef.new(shape: Message, location_name: "Message"))
|
46
54
|
InternalFailure.struct_class = Types::InternalFailure
|
47
55
|
|
56
|
+
InternalStreamFailure.add_member(:message, Shapes::ShapeRef.new(shape: Message, location_name: "Message"))
|
57
|
+
InternalStreamFailure.struct_class = Types::InternalStreamFailure
|
58
|
+
|
48
59
|
InvokeEndpointAsyncInput.add_member(:endpoint_name, Shapes::ShapeRef.new(shape: EndpointName, required: true, location: "uri", location_name: "EndpointName"))
|
49
60
|
InvokeEndpointAsyncInput.add_member(:content_type, Shapes::ShapeRef.new(shape: Header, location: "header", location_name: "X-Amzn-SageMaker-Content-Type"))
|
50
61
|
InvokeEndpointAsyncInput.add_member(:accept, Shapes::ShapeRef.new(shape: Header, location: "header", location_name: "X-Amzn-SageMaker-Accept"))
|
@@ -82,6 +93,26 @@ module Aws::SageMakerRuntime
|
|
82
93
|
InvokeEndpointOutput[:payload] = :body
|
83
94
|
InvokeEndpointOutput[:payload_member] = InvokeEndpointOutput.member(:body)
|
84
95
|
|
96
|
+
InvokeEndpointWithResponseStreamInput.add_member(:endpoint_name, Shapes::ShapeRef.new(shape: EndpointName, required: true, location: "uri", location_name: "EndpointName"))
|
97
|
+
InvokeEndpointWithResponseStreamInput.add_member(:body, Shapes::ShapeRef.new(shape: BodyBlob, required: true, location_name: "Body"))
|
98
|
+
InvokeEndpointWithResponseStreamInput.add_member(:content_type, Shapes::ShapeRef.new(shape: Header, location: "header", location_name: "Content-Type"))
|
99
|
+
InvokeEndpointWithResponseStreamInput.add_member(:accept, Shapes::ShapeRef.new(shape: Header, location: "header", location_name: "X-Amzn-SageMaker-Accept"))
|
100
|
+
InvokeEndpointWithResponseStreamInput.add_member(:custom_attributes, Shapes::ShapeRef.new(shape: CustomAttributesHeader, location: "header", location_name: "X-Amzn-SageMaker-Custom-Attributes"))
|
101
|
+
InvokeEndpointWithResponseStreamInput.add_member(:target_variant, Shapes::ShapeRef.new(shape: TargetVariantHeader, location: "header", location_name: "X-Amzn-SageMaker-Target-Variant"))
|
102
|
+
InvokeEndpointWithResponseStreamInput.add_member(:target_container_hostname, Shapes::ShapeRef.new(shape: TargetContainerHostnameHeader, location: "header", location_name: "X-Amzn-SageMaker-Target-Container-Hostname"))
|
103
|
+
InvokeEndpointWithResponseStreamInput.add_member(:inference_id, Shapes::ShapeRef.new(shape: InferenceId, location: "header", location_name: "X-Amzn-SageMaker-Inference-Id"))
|
104
|
+
InvokeEndpointWithResponseStreamInput.struct_class = Types::InvokeEndpointWithResponseStreamInput
|
105
|
+
InvokeEndpointWithResponseStreamInput[:payload] = :body
|
106
|
+
InvokeEndpointWithResponseStreamInput[:payload_member] = InvokeEndpointWithResponseStreamInput.member(:body)
|
107
|
+
|
108
|
+
InvokeEndpointWithResponseStreamOutput.add_member(:body, Shapes::ShapeRef.new(shape: ResponseStream, required: true, eventstream: true, location_name: "Body"))
|
109
|
+
InvokeEndpointWithResponseStreamOutput.add_member(:content_type, Shapes::ShapeRef.new(shape: Header, location: "header", location_name: "X-Amzn-SageMaker-Content-Type"))
|
110
|
+
InvokeEndpointWithResponseStreamOutput.add_member(:invoked_production_variant, Shapes::ShapeRef.new(shape: Header, location: "header", location_name: "x-Amzn-Invoked-Production-Variant"))
|
111
|
+
InvokeEndpointWithResponseStreamOutput.add_member(:custom_attributes, Shapes::ShapeRef.new(shape: CustomAttributesHeader, location: "header", location_name: "X-Amzn-SageMaker-Custom-Attributes"))
|
112
|
+
InvokeEndpointWithResponseStreamOutput.struct_class = Types::InvokeEndpointWithResponseStreamOutput
|
113
|
+
InvokeEndpointWithResponseStreamOutput[:payload] = :body
|
114
|
+
InvokeEndpointWithResponseStreamOutput[:payload_member] = InvokeEndpointWithResponseStreamOutput.member(:body)
|
115
|
+
|
85
116
|
ModelError.add_member(:message, Shapes::ShapeRef.new(shape: Message, location_name: "Message"))
|
86
117
|
ModelError.add_member(:original_status_code, Shapes::ShapeRef.new(shape: StatusCode, location_name: "OriginalStatusCode"))
|
87
118
|
ModelError.add_member(:original_message, Shapes::ShapeRef.new(shape: Message, location_name: "OriginalMessage"))
|
@@ -91,6 +122,18 @@ module Aws::SageMakerRuntime
|
|
91
122
|
ModelNotReadyException.add_member(:message, Shapes::ShapeRef.new(shape: Message, location_name: "Message"))
|
92
123
|
ModelNotReadyException.struct_class = Types::ModelNotReadyException
|
93
124
|
|
125
|
+
ModelStreamError.add_member(:message, Shapes::ShapeRef.new(shape: Message, location_name: "Message"))
|
126
|
+
ModelStreamError.add_member(:error_code, Shapes::ShapeRef.new(shape: ErrorCode, location_name: "ErrorCode"))
|
127
|
+
ModelStreamError.struct_class = Types::ModelStreamError
|
128
|
+
|
129
|
+
PayloadPart.add_member(:bytes, Shapes::ShapeRef.new(shape: PartBlob, eventpayload: true, eventpayload_type: 'blob', location_name: "Bytes", metadata: {"eventpayload"=>true}))
|
130
|
+
PayloadPart.struct_class = Types::PayloadPart
|
131
|
+
|
132
|
+
ResponseStream.add_member(:payload_part, Shapes::ShapeRef.new(shape: PayloadPart, event: true, location_name: "PayloadPart"))
|
133
|
+
ResponseStream.add_member(:model_stream_error, Shapes::ShapeRef.new(shape: ModelStreamError, location_name: "ModelStreamError"))
|
134
|
+
ResponseStream.add_member(:internal_stream_failure, Shapes::ShapeRef.new(shape: InternalStreamFailure, location_name: "InternalStreamFailure"))
|
135
|
+
ResponseStream.struct_class = Types::ResponseStream
|
136
|
+
|
94
137
|
ServiceUnavailable.add_member(:message, Shapes::ShapeRef.new(shape: Message, location_name: "Message"))
|
95
138
|
ServiceUnavailable.struct_class = Types::ServiceUnavailable
|
96
139
|
|
@@ -139,6 +182,20 @@ module Aws::SageMakerRuntime
|
|
139
182
|
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailable)
|
140
183
|
o.errors << Shapes::ShapeRef.new(shape: ValidationError)
|
141
184
|
end)
|
185
|
+
|
186
|
+
api.add_operation(:invoke_endpoint_with_response_stream, Seahorse::Model::Operation.new.tap do |o|
|
187
|
+
o.name = "InvokeEndpointWithResponseStream"
|
188
|
+
o.http_method = "POST"
|
189
|
+
o.http_request_uri = "/endpoints/{EndpointName}/invocations-response-stream"
|
190
|
+
o.input = Shapes::ShapeRef.new(shape: InvokeEndpointWithResponseStreamInput)
|
191
|
+
o.output = Shapes::ShapeRef.new(shape: InvokeEndpointWithResponseStreamOutput)
|
192
|
+
o.errors << Shapes::ShapeRef.new(shape: InternalFailure)
|
193
|
+
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailable)
|
194
|
+
o.errors << Shapes::ShapeRef.new(shape: ValidationError)
|
195
|
+
o.errors << Shapes::ShapeRef.new(shape: ModelError)
|
196
|
+
o.errors << Shapes::ShapeRef.new(shape: ModelStreamError)
|
197
|
+
o.errors << Shapes::ShapeRef.new(shape: InternalStreamFailure)
|
198
|
+
end)
|
142
199
|
end
|
143
200
|
|
144
201
|
end
|
@@ -40,5 +40,19 @@ module Aws::SageMakerRuntime
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
class InvokeEndpointWithResponseStream
|
44
|
+
def self.build(context)
|
45
|
+
unless context.config.regional_endpoint
|
46
|
+
endpoint = context.config.endpoint.to_s
|
47
|
+
end
|
48
|
+
Aws::SageMakerRuntime::EndpointParameters.new(
|
49
|
+
region: context.config.region,
|
50
|
+
use_dual_stack: context.config.use_dualstack_endpoint,
|
51
|
+
use_fips: context.config.use_fips_endpoint,
|
52
|
+
endpoint: endpoint,
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
43
57
|
end
|
44
58
|
end
|
@@ -29,8 +29,10 @@ module Aws::SageMakerRuntime
|
|
29
29
|
# ## Error Classes
|
30
30
|
# * {InternalDependencyException}
|
31
31
|
# * {InternalFailure}
|
32
|
+
# * {InternalStreamFailure}
|
32
33
|
# * {ModelError}
|
33
34
|
# * {ModelNotReadyException}
|
35
|
+
# * {ModelStreamError}
|
34
36
|
# * {ServiceUnavailable}
|
35
37
|
# * {ValidationError}
|
36
38
|
#
|
@@ -70,6 +72,21 @@ module Aws::SageMakerRuntime
|
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
75
|
+
class InternalStreamFailure < ServiceError
|
76
|
+
|
77
|
+
# @param [Seahorse::Client::RequestContext] context
|
78
|
+
# @param [String] message
|
79
|
+
# @param [Aws::SageMakerRuntime::Types::InternalStreamFailure] data
|
80
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
81
|
+
super(context, message, data)
|
82
|
+
end
|
83
|
+
|
84
|
+
# @return [String]
|
85
|
+
def message
|
86
|
+
@message || @data[:message]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
73
90
|
class ModelError < ServiceError
|
74
91
|
|
75
92
|
# @param [Seahorse::Client::RequestContext] context
|
@@ -115,6 +132,26 @@ module Aws::SageMakerRuntime
|
|
115
132
|
end
|
116
133
|
end
|
117
134
|
|
135
|
+
class ModelStreamError < ServiceError
|
136
|
+
|
137
|
+
# @param [Seahorse::Client::RequestContext] context
|
138
|
+
# @param [String] message
|
139
|
+
# @param [Aws::SageMakerRuntime::Types::ModelStreamError] data
|
140
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
141
|
+
super(context, message, data)
|
142
|
+
end
|
143
|
+
|
144
|
+
# @return [String]
|
145
|
+
def message
|
146
|
+
@message || @data[:message]
|
147
|
+
end
|
148
|
+
|
149
|
+
# @return [String]
|
150
|
+
def error_code
|
151
|
+
@data[:error_code]
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
118
155
|
class ServiceUnavailable < ServiceError
|
119
156
|
|
120
157
|
# @param [Seahorse::Client::RequestContext] context
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# WARNING ABOUT GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated. See the contributing guide for more information:
|
6
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
7
|
+
#
|
8
|
+
# WARNING ABOUT GENERATED CODE
|
9
|
+
|
10
|
+
module Aws::SageMakerRuntime
|
11
|
+
module EventStreams
|
12
|
+
class ResponseStream
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@event_emitter = Aws::EventEmitter.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def on_payload_part_event(&block)
|
19
|
+
@event_emitter.on(:payload_part, block) if block_given?
|
20
|
+
end
|
21
|
+
|
22
|
+
def on_model_stream_error_event(&block)
|
23
|
+
@event_emitter.on(:model_stream_error, block) if block_given?
|
24
|
+
end
|
25
|
+
|
26
|
+
def on_internal_stream_failure_event(&block)
|
27
|
+
@event_emitter.on(:internal_stream_failure, block) if block_given?
|
28
|
+
end
|
29
|
+
|
30
|
+
def on_error_event(&block)
|
31
|
+
@event_emitter.on(:error, block) if block_given?
|
32
|
+
end
|
33
|
+
|
34
|
+
def on_initial_response_event(&block)
|
35
|
+
@event_emitter.on(:initial_response, block) if block_given?
|
36
|
+
end
|
37
|
+
|
38
|
+
def on_unknown_event(&block)
|
39
|
+
@event_emitter.on(:unknown_event, block) if block_given?
|
40
|
+
end
|
41
|
+
|
42
|
+
def on_event(&block)
|
43
|
+
on_payload_part_event(&block)
|
44
|
+
on_model_stream_error_event(&block)
|
45
|
+
on_internal_stream_failure_event(&block)
|
46
|
+
on_error_event(&block)
|
47
|
+
on_initial_response_event(&block)
|
48
|
+
on_unknown_event(&block)
|
49
|
+
end
|
50
|
+
|
51
|
+
# @api private
|
52
|
+
# @return Aws::EventEmitter
|
53
|
+
attr_reader :event_emitter
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
@@ -60,6 +60,8 @@ module Aws::SageMakerRuntime
|
|
60
60
|
Aws::SageMakerRuntime::Endpoints::InvokeEndpoint.build(context)
|
61
61
|
when :invoke_endpoint_async
|
62
62
|
Aws::SageMakerRuntime::Endpoints::InvokeEndpointAsync.build(context)
|
63
|
+
when :invoke_endpoint_with_response_stream
|
64
|
+
Aws::SageMakerRuntime::Endpoints::InvokeEndpointWithResponseStream.build(context)
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
@@ -37,13 +37,27 @@ module Aws::SageMakerRuntime
|
|
37
37
|
include Aws::Structure
|
38
38
|
end
|
39
39
|
|
40
|
+
# The stream processing failed because of an unknown error, exception or
|
41
|
+
# failure. Try your request again.
|
42
|
+
#
|
43
|
+
# @!attribute [rw] message
|
44
|
+
# @return [String]
|
45
|
+
#
|
46
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InternalStreamFailure AWS API Documentation
|
47
|
+
#
|
48
|
+
class InternalStreamFailure < Struct.new(
|
49
|
+
:message)
|
50
|
+
SENSITIVE = []
|
51
|
+
include Aws::Structure
|
52
|
+
end
|
53
|
+
|
40
54
|
# @!attribute [rw] endpoint_name
|
41
55
|
# The name of the endpoint that you specified when you created the
|
42
|
-
# endpoint using the [
|
56
|
+
# endpoint using the [CreateEndpoint][1] API.
|
43
57
|
#
|
44
58
|
#
|
45
59
|
#
|
46
|
-
# [1]: https://docs.aws.amazon.com/sagemaker/latest/
|
60
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html
|
47
61
|
# @return [String]
|
48
62
|
#
|
49
63
|
# @!attribute [rw] content_type
|
@@ -51,7 +65,8 @@ module Aws::SageMakerRuntime
|
|
51
65
|
# @return [String]
|
52
66
|
#
|
53
67
|
# @!attribute [rw] accept
|
54
|
-
# The desired MIME type of the inference
|
68
|
+
# The desired MIME type of the inference response from the model
|
69
|
+
# container.
|
55
70
|
# @return [String]
|
56
71
|
#
|
57
72
|
# @!attribute [rw] custom_attributes
|
@@ -69,7 +84,7 @@ module Aws::SageMakerRuntime
|
|
69
84
|
# custom attributes in the response. If your code does not set this
|
70
85
|
# value in the response, an empty value is returned. For example, if a
|
71
86
|
# custom attribute represents the trace ID, your model can prepend the
|
72
|
-
# custom attribute with `Trace ID
|
87
|
+
# custom attribute with `Trace ID:` in your post-processing function.
|
73
88
|
#
|
74
89
|
# This feature is currently supported in the Amazon Web Services SDKs
|
75
90
|
# but not in the Amazon SageMaker Python SDK.
|
@@ -165,7 +180,8 @@ module Aws::SageMakerRuntime
|
|
165
180
|
# @return [String]
|
166
181
|
#
|
167
182
|
# @!attribute [rw] accept
|
168
|
-
# The desired MIME type of the inference
|
183
|
+
# The desired MIME type of the inference response from the model
|
184
|
+
# container.
|
169
185
|
# @return [String]
|
170
186
|
#
|
171
187
|
# @!attribute [rw] custom_attributes
|
@@ -190,7 +206,7 @@ module Aws::SageMakerRuntime
|
|
190
206
|
#
|
191
207
|
#
|
192
208
|
#
|
193
|
-
# [1]: https://
|
209
|
+
# [1]: https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
|
194
210
|
# @return [String]
|
195
211
|
#
|
196
212
|
# @!attribute [rw] target_model
|
@@ -274,7 +290,7 @@ module Aws::SageMakerRuntime
|
|
274
290
|
# @return [String]
|
275
291
|
#
|
276
292
|
# @!attribute [rw] content_type
|
277
|
-
# The MIME type of the inference returned
|
293
|
+
# The MIME type of the inference returned from the model container.
|
278
294
|
# @return [String]
|
279
295
|
#
|
280
296
|
# @!attribute [rw] invoked_production_variant
|
@@ -319,6 +335,153 @@ module Aws::SageMakerRuntime
|
|
319
335
|
include Aws::Structure
|
320
336
|
end
|
321
337
|
|
338
|
+
# @!attribute [rw] endpoint_name
|
339
|
+
# The name of the endpoint that you specified when you created the
|
340
|
+
# endpoint using the [CreateEndpoint][1] API.
|
341
|
+
#
|
342
|
+
#
|
343
|
+
#
|
344
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html
|
345
|
+
# @return [String]
|
346
|
+
#
|
347
|
+
# @!attribute [rw] body
|
348
|
+
# Provides input data, in the format specified in the `ContentType`
|
349
|
+
# request header. Amazon SageMaker passes all of the data in the body
|
350
|
+
# to the model.
|
351
|
+
#
|
352
|
+
# For information about the format of the request body, see [Common
|
353
|
+
# Data Formats-Inference][1].
|
354
|
+
#
|
355
|
+
#
|
356
|
+
#
|
357
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html
|
358
|
+
# @return [String]
|
359
|
+
#
|
360
|
+
# @!attribute [rw] content_type
|
361
|
+
# The MIME type of the input data in the request body.
|
362
|
+
# @return [String]
|
363
|
+
#
|
364
|
+
# @!attribute [rw] accept
|
365
|
+
# The desired MIME type of the inference response from the model
|
366
|
+
# container.
|
367
|
+
# @return [String]
|
368
|
+
#
|
369
|
+
# @!attribute [rw] custom_attributes
|
370
|
+
# Provides additional information about a request for an inference
|
371
|
+
# submitted to a model hosted at an Amazon SageMaker endpoint. The
|
372
|
+
# information is an opaque value that is forwarded verbatim. You could
|
373
|
+
# use this value, for example, to provide an ID that you can use to
|
374
|
+
# track a request or to provide other metadata that a service endpoint
|
375
|
+
# was programmed to process. The value must consist of no more than
|
376
|
+
# 1024 visible US-ASCII characters as specified in [Section 3.3.6.
|
377
|
+
# Field Value Components][1] of the Hypertext Transfer Protocol
|
378
|
+
# (HTTP/1.1).
|
379
|
+
#
|
380
|
+
# The code in your model is responsible for setting or updating any
|
381
|
+
# custom attributes in the response. If your code does not set this
|
382
|
+
# value in the response, an empty value is returned. For example, if a
|
383
|
+
# custom attribute represents the trace ID, your model can prepend the
|
384
|
+
# custom attribute with `Trace ID:` in your post-processing function.
|
385
|
+
#
|
386
|
+
# This feature is currently supported in the Amazon Web Services SDKs
|
387
|
+
# but not in the Amazon SageMaker Python SDK.
|
388
|
+
#
|
389
|
+
#
|
390
|
+
#
|
391
|
+
# [1]: https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
|
392
|
+
# @return [String]
|
393
|
+
#
|
394
|
+
# @!attribute [rw] target_variant
|
395
|
+
# Specify the production variant to send the inference request to when
|
396
|
+
# invoking an endpoint that is running two or more variants. Note that
|
397
|
+
# this parameter overrides the default behavior for the endpoint,
|
398
|
+
# which is to distribute the invocation traffic based on the variant
|
399
|
+
# weights.
|
400
|
+
#
|
401
|
+
# For information about how to use variant targeting to perform a/b
|
402
|
+
# testing, see [Test models in production][1]
|
403
|
+
#
|
404
|
+
#
|
405
|
+
#
|
406
|
+
# [1]: https://docs.aws.amazon.com/sagemaker/latest/dg/model-ab-testing.html
|
407
|
+
# @return [String]
|
408
|
+
#
|
409
|
+
# @!attribute [rw] target_container_hostname
|
410
|
+
# If the endpoint hosts multiple containers and is configured to use
|
411
|
+
# direct invocation, this parameter specifies the host name of the
|
412
|
+
# container to invoke.
|
413
|
+
# @return [String]
|
414
|
+
#
|
415
|
+
# @!attribute [rw] inference_id
|
416
|
+
# An identifier that you assign to your request.
|
417
|
+
# @return [String]
|
418
|
+
#
|
419
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InvokeEndpointWithResponseStreamInput AWS API Documentation
|
420
|
+
#
|
421
|
+
class InvokeEndpointWithResponseStreamInput < Struct.new(
|
422
|
+
:endpoint_name,
|
423
|
+
:body,
|
424
|
+
:content_type,
|
425
|
+
:accept,
|
426
|
+
:custom_attributes,
|
427
|
+
:target_variant,
|
428
|
+
:target_container_hostname,
|
429
|
+
:inference_id)
|
430
|
+
SENSITIVE = [:body, :custom_attributes]
|
431
|
+
include Aws::Structure
|
432
|
+
end
|
433
|
+
|
434
|
+
# @!attribute [rw] body
|
435
|
+
# A stream of payload parts. Each part contains a portion of the
|
436
|
+
# response for a streaming inference request.
|
437
|
+
# @return [Types::ResponseStream]
|
438
|
+
#
|
439
|
+
# @!attribute [rw] content_type
|
440
|
+
# The MIME type of the inference returned from the model container.
|
441
|
+
# @return [String]
|
442
|
+
#
|
443
|
+
# @!attribute [rw] invoked_production_variant
|
444
|
+
# Identifies the production variant that was invoked.
|
445
|
+
# @return [String]
|
446
|
+
#
|
447
|
+
# @!attribute [rw] custom_attributes
|
448
|
+
# Provides additional information in the response about the inference
|
449
|
+
# returned by a model hosted at an Amazon SageMaker endpoint. The
|
450
|
+
# information is an opaque value that is forwarded verbatim. You could
|
451
|
+
# use this value, for example, to return an ID received in the
|
452
|
+
# `CustomAttributes` header of a request or other metadata that a
|
453
|
+
# service endpoint was programmed to produce. The value must consist
|
454
|
+
# of no more than 1024 visible US-ASCII characters as specified in
|
455
|
+
# [Section 3.3.6. Field Value Components][1] of the Hypertext Transfer
|
456
|
+
# Protocol (HTTP/1.1). If the customer wants the custom attribute
|
457
|
+
# returned, the model must set the custom attribute to be included on
|
458
|
+
# the way back.
|
459
|
+
#
|
460
|
+
# The code in your model is responsible for setting or updating any
|
461
|
+
# custom attributes in the response. If your code does not set this
|
462
|
+
# value in the response, an empty value is returned. For example, if a
|
463
|
+
# custom attribute represents the trace ID, your model can prepend the
|
464
|
+
# custom attribute with `Trace ID:` in your post-processing function.
|
465
|
+
#
|
466
|
+
# This feature is currently supported in the Amazon Web Services SDKs
|
467
|
+
# but not in the Amazon SageMaker Python SDK.
|
468
|
+
#
|
469
|
+
#
|
470
|
+
#
|
471
|
+
# [1]: https://tools.ietf.org/html/rfc7230#section-3.2.6
|
472
|
+
# @return [String]
|
473
|
+
#
|
474
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InvokeEndpointWithResponseStreamOutput AWS API Documentation
|
475
|
+
#
|
476
|
+
class InvokeEndpointWithResponseStreamOutput < Struct.new(
|
477
|
+
:body,
|
478
|
+
:content_type,
|
479
|
+
:invoked_production_variant,
|
480
|
+
:custom_attributes)
|
481
|
+
SENSITIVE = [:custom_attributes]
|
482
|
+
include Aws::Structure
|
483
|
+
end
|
484
|
+
|
322
485
|
# Model (owned by the customer in the container) returned 4xx or 5xx
|
323
486
|
# error code.
|
324
487
|
#
|
@@ -363,6 +526,63 @@ module Aws::SageMakerRuntime
|
|
363
526
|
include Aws::Structure
|
364
527
|
end
|
365
528
|
|
529
|
+
# An error occurred while streaming the response body. This error can
|
530
|
+
# have the following error codes:
|
531
|
+
#
|
532
|
+
# ModelInvocationTimeExceeded
|
533
|
+
#
|
534
|
+
# : The model failed to finish sending the response within the timeout
|
535
|
+
# period allowed by Amazon SageMaker.
|
536
|
+
#
|
537
|
+
# StreamBroken
|
538
|
+
#
|
539
|
+
# : The Transmission Control Protocol (TCP) connection between the
|
540
|
+
# client and the model was reset or closed.
|
541
|
+
#
|
542
|
+
# @!attribute [rw] message
|
543
|
+
# @return [String]
|
544
|
+
#
|
545
|
+
# @!attribute [rw] error_code
|
546
|
+
# This error can have the following error codes:
|
547
|
+
#
|
548
|
+
# ModelInvocationTimeExceeded
|
549
|
+
#
|
550
|
+
# : The model failed to finish sending the response within the timeout
|
551
|
+
# period allowed by Amazon SageMaker.
|
552
|
+
#
|
553
|
+
# StreamBroken
|
554
|
+
#
|
555
|
+
# : The Transmission Control Protocol (TCP) connection between the
|
556
|
+
# client and the model was reset or closed.
|
557
|
+
# @return [String]
|
558
|
+
#
|
559
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/ModelStreamError AWS API Documentation
|
560
|
+
#
|
561
|
+
class ModelStreamError < Struct.new(
|
562
|
+
:message,
|
563
|
+
:error_code)
|
564
|
+
SENSITIVE = []
|
565
|
+
include Aws::Structure
|
566
|
+
end
|
567
|
+
|
568
|
+
# A wrapper for pieces of the payload that's returned in response to a
|
569
|
+
# streaming inference request. A streaming inference response consists
|
570
|
+
# of one or more payload parts.
|
571
|
+
#
|
572
|
+
# @!attribute [rw] bytes
|
573
|
+
# A blob that contains part of the response for your streaming
|
574
|
+
# inference request.
|
575
|
+
# @return [String]
|
576
|
+
#
|
577
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/PayloadPart AWS API Documentation
|
578
|
+
#
|
579
|
+
class PayloadPart < Struct.new(
|
580
|
+
:bytes,
|
581
|
+
:event_type)
|
582
|
+
SENSITIVE = [:bytes]
|
583
|
+
include Aws::Structure
|
584
|
+
end
|
585
|
+
|
366
586
|
# The service is unavailable. Try your call again.
|
367
587
|
#
|
368
588
|
# @!attribute [rw] message
|
@@ -389,5 +609,25 @@ module Aws::SageMakerRuntime
|
|
389
609
|
include Aws::Structure
|
390
610
|
end
|
391
611
|
|
612
|
+
# A stream of payload parts. Each part contains a portion of the
|
613
|
+
# response for a streaming inference request.
|
614
|
+
#
|
615
|
+
# EventStream is an Enumerator of Events.
|
616
|
+
# #event_types #=> Array, returns all modeled event types in the stream
|
617
|
+
#
|
618
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/ResponseStream AWS API Documentation
|
619
|
+
#
|
620
|
+
class ResponseStream < Enumerator
|
621
|
+
|
622
|
+
def event_types
|
623
|
+
[
|
624
|
+
:payload_part,
|
625
|
+
:model_stream_error,
|
626
|
+
:internal_stream_failure
|
627
|
+
]
|
628
|
+
end
|
629
|
+
|
630
|
+
end
|
631
|
+
|
392
632
|
end
|
393
633
|
end
|
@@ -21,6 +21,7 @@ require_relative 'aws-sdk-sagemakerruntime/endpoint_parameters'
|
|
21
21
|
require_relative 'aws-sdk-sagemakerruntime/endpoint_provider'
|
22
22
|
require_relative 'aws-sdk-sagemakerruntime/endpoints'
|
23
23
|
require_relative 'aws-sdk-sagemakerruntime/customizations'
|
24
|
+
require_relative 'aws-sdk-sagemakerruntime/event_streams'
|
24
25
|
|
25
26
|
# This module provides support for Amazon SageMaker Runtime. This module is available in the
|
26
27
|
# `aws-sdk-sagemakerruntime` gem.
|
@@ -52,6 +53,6 @@ require_relative 'aws-sdk-sagemakerruntime/customizations'
|
|
52
53
|
# @!group service
|
53
54
|
module Aws::SageMakerRuntime
|
54
55
|
|
55
|
-
GEM_VERSION = '1.
|
56
|
+
GEM_VERSION = '1.56.0'
|
56
57
|
|
57
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-sagemakerruntime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.56.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.
|
22
|
+
version: 3.184.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.
|
32
|
+
version: 3.184.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: aws-sigv4
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/aws-sdk-sagemakerruntime/endpoint_provider.rb
|
64
64
|
- lib/aws-sdk-sagemakerruntime/endpoints.rb
|
65
65
|
- lib/aws-sdk-sagemakerruntime/errors.rb
|
66
|
+
- lib/aws-sdk-sagemakerruntime/event_streams.rb
|
66
67
|
- lib/aws-sdk-sagemakerruntime/plugins/endpoints.rb
|
67
68
|
- lib/aws-sdk-sagemakerruntime/resource.rb
|
68
69
|
- lib/aws-sdk-sagemakerruntime/types.rb
|