aws-sdk-bedrockruntime 1.15.0 → 1.17.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-bedrockruntime/client.rb +156 -6
- data/lib/aws-sdk-bedrockruntime/client_api.rb +107 -1
- data/lib/aws-sdk-bedrockruntime/endpoints.rb +14 -0
- data/lib/aws-sdk-bedrockruntime/errors.rb +16 -0
- data/lib/aws-sdk-bedrockruntime/event_streams.rb +10 -0
- data/lib/aws-sdk-bedrockruntime/plugins/endpoints.rb +2 -0
- data/lib/aws-sdk-bedrockruntime/types.rb +331 -41
- data/lib/aws-sdk-bedrockruntime.rb +2 -2
- data/sig/client.rbs +31 -4
- data/sig/errors.rbs +3 -0
- data/sig/types.rbs +71 -2
- metadata +4 -4
@@ -12,6 +12,20 @@ module Aws::BedrockRuntime
|
|
12
12
|
# @api private
|
13
13
|
module Endpoints
|
14
14
|
|
15
|
+
class ApplyGuardrail
|
16
|
+
def self.build(context)
|
17
|
+
unless context.config.regional_endpoint
|
18
|
+
endpoint = context.config.endpoint.to_s
|
19
|
+
end
|
20
|
+
Aws::BedrockRuntime::EndpointParameters.new(
|
21
|
+
region: context.config.region,
|
22
|
+
use_dual_stack: context.config.use_dualstack_endpoint,
|
23
|
+
use_fips: context.config.use_fips_endpoint,
|
24
|
+
endpoint: endpoint,
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
15
29
|
class Converse
|
16
30
|
def self.build(context)
|
17
31
|
unless context.config.regional_endpoint
|
@@ -35,6 +35,7 @@ module Aws::BedrockRuntime
|
|
35
35
|
# * {ModelTimeoutException}
|
36
36
|
# * {ResourceNotFoundException}
|
37
37
|
# * {ServiceQuotaExceededException}
|
38
|
+
# * {ServiceUnavailableException}
|
38
39
|
# * {ThrottlingException}
|
39
40
|
# * {ValidationException}
|
40
41
|
#
|
@@ -184,6 +185,21 @@ module Aws::BedrockRuntime
|
|
184
185
|
end
|
185
186
|
end
|
186
187
|
|
188
|
+
class ServiceUnavailableException < ServiceError
|
189
|
+
|
190
|
+
# @param [Seahorse::Client::RequestContext] context
|
191
|
+
# @param [String] message
|
192
|
+
# @param [Aws::BedrockRuntime::Types::ServiceUnavailableException] data
|
193
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
194
|
+
super(context, message, data)
|
195
|
+
end
|
196
|
+
|
197
|
+
# @return [String]
|
198
|
+
def message
|
199
|
+
@message || @data[:message]
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
187
203
|
class ThrottlingException < ServiceError
|
188
204
|
|
189
205
|
# @param [Seahorse::Client::RequestContext] context
|
@@ -55,6 +55,10 @@ module Aws::BedrockRuntime
|
|
55
55
|
@event_emitter.on(:throttling_exception, block) if block_given?
|
56
56
|
end
|
57
57
|
|
58
|
+
def on_service_unavailable_exception_event(&block)
|
59
|
+
@event_emitter.on(:service_unavailable_exception, block) if block_given?
|
60
|
+
end
|
61
|
+
|
58
62
|
def on_error_event(&block)
|
59
63
|
@event_emitter.on(:error, block) if block_given?
|
60
64
|
end
|
@@ -78,6 +82,7 @@ module Aws::BedrockRuntime
|
|
78
82
|
on_model_stream_error_exception_event(&block)
|
79
83
|
on_validation_exception_event(&block)
|
80
84
|
on_throttling_exception_event(&block)
|
85
|
+
on_service_unavailable_exception_event(&block)
|
81
86
|
on_error_event(&block)
|
82
87
|
on_initial_response_event(&block)
|
83
88
|
on_unknown_event(&block)
|
@@ -118,6 +123,10 @@ module Aws::BedrockRuntime
|
|
118
123
|
@event_emitter.on(:model_timeout_exception, block) if block_given?
|
119
124
|
end
|
120
125
|
|
126
|
+
def on_service_unavailable_exception_event(&block)
|
127
|
+
@event_emitter.on(:service_unavailable_exception, block) if block_given?
|
128
|
+
end
|
129
|
+
|
121
130
|
def on_error_event(&block)
|
122
131
|
@event_emitter.on(:error, block) if block_given?
|
123
132
|
end
|
@@ -137,6 +146,7 @@ module Aws::BedrockRuntime
|
|
137
146
|
on_validation_exception_event(&block)
|
138
147
|
on_throttling_exception_event(&block)
|
139
148
|
on_model_timeout_exception_event(&block)
|
149
|
+
on_service_unavailable_exception_event(&block)
|
140
150
|
on_error_event(&block)
|
141
151
|
on_initial_response_event(&block)
|
142
152
|
on_unknown_event(&block)
|
@@ -58,6 +58,8 @@ module Aws::BedrockRuntime
|
|
58
58
|
|
59
59
|
def parameters_for_operation(context)
|
60
60
|
case context.operation_name
|
61
|
+
when :apply_guardrail
|
62
|
+
Aws::BedrockRuntime::Endpoints::ApplyGuardrail.build(context)
|
61
63
|
when :converse
|
62
64
|
Aws::BedrockRuntime::Endpoints::Converse.build(context)
|
63
65
|
when :converse_stream
|
@@ -32,6 +32,60 @@ module Aws::BedrockRuntime
|
|
32
32
|
#
|
33
33
|
class AnyToolChoice < Aws::EmptyStructure; end
|
34
34
|
|
35
|
+
# @!attribute [rw] guardrail_identifier
|
36
|
+
# The guardrail identifier used in the request to apply the guardrail.
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @!attribute [rw] guardrail_version
|
40
|
+
# The guardrail version used in the request to apply the guardrail.
|
41
|
+
# @return [String]
|
42
|
+
#
|
43
|
+
# @!attribute [rw] source
|
44
|
+
# The source of data used in the request to apply the guardrail.
|
45
|
+
# @return [String]
|
46
|
+
#
|
47
|
+
# @!attribute [rw] content
|
48
|
+
# The content details used in the request to apply the guardrail.
|
49
|
+
# @return [Array<Types::GuardrailContentBlock>]
|
50
|
+
#
|
51
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ApplyGuardrailRequest AWS API Documentation
|
52
|
+
#
|
53
|
+
class ApplyGuardrailRequest < Struct.new(
|
54
|
+
:guardrail_identifier,
|
55
|
+
:guardrail_version,
|
56
|
+
:source,
|
57
|
+
:content)
|
58
|
+
SENSITIVE = []
|
59
|
+
include Aws::Structure
|
60
|
+
end
|
61
|
+
|
62
|
+
# @!attribute [rw] usage
|
63
|
+
# The usage details in the response from the guardrail.
|
64
|
+
# @return [Types::GuardrailUsage]
|
65
|
+
#
|
66
|
+
# @!attribute [rw] action
|
67
|
+
# The action taken in the response from the guardrail.
|
68
|
+
# @return [String]
|
69
|
+
#
|
70
|
+
# @!attribute [rw] outputs
|
71
|
+
# The output details in the response from the guardrail.
|
72
|
+
# @return [Array<Types::GuardrailOutputContent>]
|
73
|
+
#
|
74
|
+
# @!attribute [rw] assessments
|
75
|
+
# The assessment details in the response from the guardrail.
|
76
|
+
# @return [Array<Types::GuardrailAssessment>]
|
77
|
+
#
|
78
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ApplyGuardrailResponse AWS API Documentation
|
79
|
+
#
|
80
|
+
class ApplyGuardrailResponse < Struct.new(
|
81
|
+
:usage,
|
82
|
+
:action,
|
83
|
+
:outputs,
|
84
|
+
:assessments)
|
85
|
+
SENSITIVE = []
|
86
|
+
include Aws::Structure
|
87
|
+
end
|
88
|
+
|
35
89
|
# The Model automatically decides if a tool should be called or whether
|
36
90
|
# to generate text instead. For example, `\{"auto" : \{\}\}`.
|
37
91
|
#
|
@@ -42,7 +96,12 @@ module Aws::BedrockRuntime
|
|
42
96
|
class AutoToolChoice < Aws::EmptyStructure; end
|
43
97
|
|
44
98
|
# A block of content for a message that you pass to, or receive from, a
|
45
|
-
# model with the Converse
|
99
|
+
# model with the [Converse][1] or [ConverseStream][2] API operations.
|
100
|
+
#
|
101
|
+
#
|
102
|
+
#
|
103
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
104
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
|
46
105
|
#
|
47
106
|
# @note ContentBlock is a union - when making an API calls you must set exactly one of the members.
|
48
107
|
#
|
@@ -403,8 +462,12 @@ module Aws::BedrockRuntime
|
|
403
462
|
# @return [Types::ConverseStreamMetrics]
|
404
463
|
#
|
405
464
|
# @!attribute [rw] trace
|
406
|
-
# The trace object in the response from ConverseStream that
|
407
|
-
# information about the guardrail behavior.
|
465
|
+
# The trace object in the response from [ConverseStream][1] that
|
466
|
+
# contains information about the guardrail behavior.
|
467
|
+
#
|
468
|
+
#
|
469
|
+
#
|
470
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
|
408
471
|
# @return [Types::ConverseStreamTrace]
|
409
472
|
#
|
410
473
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseStreamMetadataEvent AWS API Documentation
|
@@ -540,8 +603,12 @@ module Aws::BedrockRuntime
|
|
540
603
|
include Aws::Structure
|
541
604
|
end
|
542
605
|
|
543
|
-
# The trace object in a response from ConverseStream. Currently,
|
544
|
-
# only trace guardrails.
|
606
|
+
# The trace object in a response from [ConverseStream][1]. Currently,
|
607
|
+
# you can only trace guardrails.
|
608
|
+
#
|
609
|
+
#
|
610
|
+
#
|
611
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
|
545
612
|
#
|
546
613
|
# @!attribute [rw] guardrail
|
547
614
|
# The guardrail trace object.
|
@@ -555,8 +622,12 @@ module Aws::BedrockRuntime
|
|
555
622
|
include Aws::Structure
|
556
623
|
end
|
557
624
|
|
558
|
-
# The trace object in a response from Converse. Currently, you can
|
559
|
-
# trace guardrails.
|
625
|
+
# The trace object in a response from [Converse][1]. Currently, you can
|
626
|
+
# only trace guardrails.
|
627
|
+
#
|
628
|
+
#
|
629
|
+
#
|
630
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
560
631
|
#
|
561
632
|
# @!attribute [rw] guardrail
|
562
633
|
# The guardrail trace object.
|
@@ -570,21 +641,31 @@ module Aws::BedrockRuntime
|
|
570
641
|
include Aws::Structure
|
571
642
|
end
|
572
643
|
|
573
|
-
# A document to include in a message
|
574
|
-
# [ConverseStream][2] request. You can include up to 5 documents in a
|
575
|
-
# request. The maximum document size is 50 MB.
|
576
|
-
#
|
577
|
-
#
|
578
|
-
#
|
579
|
-
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
580
|
-
# [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
|
644
|
+
# A document to include in a message.
|
581
645
|
#
|
582
646
|
# @!attribute [rw] format
|
583
647
|
# The format of a document, or its extension.
|
584
648
|
# @return [String]
|
585
649
|
#
|
586
650
|
# @!attribute [rw] name
|
587
|
-
# A name for the document.
|
651
|
+
# A name for the document. The name can only contain the following
|
652
|
+
# characters:
|
653
|
+
#
|
654
|
+
# * Alphanumeric characters
|
655
|
+
#
|
656
|
+
# * Whitespace characters (no more than one in a row)
|
657
|
+
#
|
658
|
+
# * Hyphens
|
659
|
+
#
|
660
|
+
# * Parentheses
|
661
|
+
#
|
662
|
+
# * Square brackets
|
663
|
+
#
|
664
|
+
# <note markdown="1"> This field is vulnerable to prompt injections, because the model
|
665
|
+
# might inadvertently interpret it as instructions. Therefore, we
|
666
|
+
# recommend that you specify a neutral name.
|
667
|
+
#
|
668
|
+
# </note>
|
588
669
|
# @return [String]
|
589
670
|
#
|
590
671
|
# @!attribute [rw] source
|
@@ -601,22 +682,15 @@ module Aws::BedrockRuntime
|
|
601
682
|
include Aws::Structure
|
602
683
|
end
|
603
684
|
|
604
|
-
# Contains the content of
|
605
|
-
# sending a [Converse][1] or [ConverseStream][2] request or in the
|
606
|
-
# response.
|
607
|
-
#
|
608
|
-
#
|
609
|
-
#
|
610
|
-
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
611
|
-
# [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
|
685
|
+
# Contains the content of a document.
|
612
686
|
#
|
613
687
|
# @note DocumentSource is a union - when making an API calls you must set exactly one of the members.
|
614
688
|
#
|
615
689
|
# @note DocumentSource is a union - when returned from an API call exactly one value will be set and the returned type will be a subclass of DocumentSource corresponding to the set member.
|
616
690
|
#
|
617
691
|
# @!attribute [rw] bytes
|
618
|
-
#
|
619
|
-
#
|
692
|
+
# The raw bytes for the document. If you use an Amazon Web Services
|
693
|
+
# SDK, you don't need to encode the bytes in base64.
|
620
694
|
# @return [String]
|
621
695
|
#
|
622
696
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/DocumentSource AWS API Documentation
|
@@ -651,19 +725,28 @@ module Aws::BedrockRuntime
|
|
651
725
|
# The sensitive information policy.
|
652
726
|
# @return [Types::GuardrailSensitiveInformationPolicyAssessment]
|
653
727
|
#
|
728
|
+
# @!attribute [rw] contextual_grounding_policy
|
729
|
+
# The contextual grounding policy used for the guardrail assessment.
|
730
|
+
# @return [Types::GuardrailContextualGroundingPolicyAssessment]
|
731
|
+
#
|
654
732
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailAssessment AWS API Documentation
|
655
733
|
#
|
656
734
|
class GuardrailAssessment < Struct.new(
|
657
735
|
:topic_policy,
|
658
736
|
:content_policy,
|
659
737
|
:word_policy,
|
660
|
-
:sensitive_information_policy
|
738
|
+
:sensitive_information_policy,
|
739
|
+
:contextual_grounding_policy)
|
661
740
|
SENSITIVE = []
|
662
741
|
include Aws::Structure
|
663
742
|
end
|
664
743
|
|
665
744
|
# Configuration information for a guardrail that you use with the
|
666
|
-
# Converse
|
745
|
+
# [Converse][1] operation.
|
746
|
+
#
|
747
|
+
#
|
748
|
+
#
|
749
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
667
750
|
#
|
668
751
|
# @!attribute [rw] guardrail_identifier
|
669
752
|
# The identifier for the guardrail.
|
@@ -687,6 +770,27 @@ module Aws::BedrockRuntime
|
|
687
770
|
include Aws::Structure
|
688
771
|
end
|
689
772
|
|
773
|
+
# The content block to be evaluated by the guardrail.
|
774
|
+
#
|
775
|
+
# @note GuardrailContentBlock is a union - when making an API calls you must set exactly one of the members.
|
776
|
+
#
|
777
|
+
# @!attribute [rw] text
|
778
|
+
# Text within content block to be evaluated by the guardrail.
|
779
|
+
# @return [Types::GuardrailTextBlock]
|
780
|
+
#
|
781
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailContentBlock AWS API Documentation
|
782
|
+
#
|
783
|
+
class GuardrailContentBlock < Struct.new(
|
784
|
+
:text,
|
785
|
+
:unknown)
|
786
|
+
SENSITIVE = []
|
787
|
+
include Aws::Structure
|
788
|
+
include Aws::Structure::Union
|
789
|
+
|
790
|
+
class Text < GuardrailContentBlock; end
|
791
|
+
class Unknown < GuardrailContentBlock; end
|
792
|
+
end
|
793
|
+
|
690
794
|
# The content filter for a guardrail.
|
691
795
|
#
|
692
796
|
# @!attribute [rw] type
|
@@ -725,8 +829,58 @@ module Aws::BedrockRuntime
|
|
725
829
|
include Aws::Structure
|
726
830
|
end
|
727
831
|
|
728
|
-
#
|
729
|
-
#
|
832
|
+
# The details for the guardrails contextual grounding filter.
|
833
|
+
#
|
834
|
+
# @!attribute [rw] type
|
835
|
+
# The contextual grounding filter type.
|
836
|
+
# @return [String]
|
837
|
+
#
|
838
|
+
# @!attribute [rw] threshold
|
839
|
+
# The threshold used by contextual grounding filter to determine
|
840
|
+
# whether the content is grounded or not.
|
841
|
+
# @return [Float]
|
842
|
+
#
|
843
|
+
# @!attribute [rw] score
|
844
|
+
# The score generated by contextual grounding filter.
|
845
|
+
# @return [Float]
|
846
|
+
#
|
847
|
+
# @!attribute [rw] action
|
848
|
+
# The action performed by the guardrails contextual grounding filter.
|
849
|
+
# @return [String]
|
850
|
+
#
|
851
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailContextualGroundingFilter AWS API Documentation
|
852
|
+
#
|
853
|
+
class GuardrailContextualGroundingFilter < Struct.new(
|
854
|
+
:type,
|
855
|
+
:threshold,
|
856
|
+
:score,
|
857
|
+
:action)
|
858
|
+
SENSITIVE = []
|
859
|
+
include Aws::Structure
|
860
|
+
end
|
861
|
+
|
862
|
+
# The policy assessment details for the guardrails contextual grounding
|
863
|
+
# filter.
|
864
|
+
#
|
865
|
+
# @!attribute [rw] filters
|
866
|
+
# The filter details for the guardrails contextual grounding filter.
|
867
|
+
# @return [Array<Types::GuardrailContextualGroundingFilter>]
|
868
|
+
#
|
869
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailContextualGroundingPolicyAssessment AWS API Documentation
|
870
|
+
#
|
871
|
+
class GuardrailContextualGroundingPolicyAssessment < Struct.new(
|
872
|
+
:filters)
|
873
|
+
SENSITIVE = []
|
874
|
+
include Aws::Structure
|
875
|
+
end
|
876
|
+
|
877
|
+
# A content block for selective guarding with the [Converse][1] or
|
878
|
+
# [ConverseStream][2] API operations.
|
879
|
+
#
|
880
|
+
#
|
881
|
+
#
|
882
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
883
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
|
730
884
|
#
|
731
885
|
# @note GuardrailConverseContentBlock is a union - when making an API calls you must set exactly one of the members.
|
732
886
|
#
|
@@ -756,10 +910,16 @@ module Aws::BedrockRuntime
|
|
756
910
|
# The text that you want to guard.
|
757
911
|
# @return [String]
|
758
912
|
#
|
913
|
+
# @!attribute [rw] qualifiers
|
914
|
+
# The qualifier details for the guardrails contextual grounding
|
915
|
+
# filter.
|
916
|
+
# @return [Array<String>]
|
917
|
+
#
|
759
918
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailConverseTextBlock AWS API Documentation
|
760
919
|
#
|
761
920
|
class GuardrailConverseTextBlock < Struct.new(
|
762
|
-
:text
|
921
|
+
:text,
|
922
|
+
:qualifiers)
|
763
923
|
SENSITIVE = []
|
764
924
|
include Aws::Structure
|
765
925
|
end
|
@@ -807,6 +967,20 @@ module Aws::BedrockRuntime
|
|
807
967
|
include Aws::Structure
|
808
968
|
end
|
809
969
|
|
970
|
+
# The output content produced by the guardrail.
|
971
|
+
#
|
972
|
+
# @!attribute [rw] text
|
973
|
+
# The specific text for the output content produced by the guardrail.
|
974
|
+
# @return [String]
|
975
|
+
#
|
976
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailOutputContent AWS API Documentation
|
977
|
+
#
|
978
|
+
class GuardrailOutputContent < Struct.new(
|
979
|
+
:text)
|
980
|
+
SENSITIVE = []
|
981
|
+
include Aws::Structure
|
982
|
+
end
|
983
|
+
|
810
984
|
# A Personally Identifiable Information (PII) entity configured in a
|
811
985
|
# guardrail.
|
812
986
|
#
|
@@ -913,6 +1087,25 @@ module Aws::BedrockRuntime
|
|
913
1087
|
include Aws::Structure
|
914
1088
|
end
|
915
1089
|
|
1090
|
+
# The text block to be evaluated by the guardrail.
|
1091
|
+
#
|
1092
|
+
# @!attribute [rw] text
|
1093
|
+
# The input text details to be evaluated by the guardrail.
|
1094
|
+
# @return [String]
|
1095
|
+
#
|
1096
|
+
# @!attribute [rw] qualifiers
|
1097
|
+
# The qualifiers describing the text block.
|
1098
|
+
# @return [Array<String>]
|
1099
|
+
#
|
1100
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailTextBlock AWS API Documentation
|
1101
|
+
#
|
1102
|
+
class GuardrailTextBlock < Struct.new(
|
1103
|
+
:text,
|
1104
|
+
:qualifiers)
|
1105
|
+
SENSITIVE = []
|
1106
|
+
include Aws::Structure
|
1107
|
+
end
|
1108
|
+
|
916
1109
|
# Information about a topic guardrail.
|
917
1110
|
#
|
918
1111
|
# @!attribute [rw] name
|
@@ -977,6 +1170,46 @@ module Aws::BedrockRuntime
|
|
977
1170
|
include Aws::Structure
|
978
1171
|
end
|
979
1172
|
|
1173
|
+
# The details on the use of the guardrail.
|
1174
|
+
#
|
1175
|
+
# @!attribute [rw] topic_policy_units
|
1176
|
+
# The topic policy units processed by the guardrail.
|
1177
|
+
# @return [Integer]
|
1178
|
+
#
|
1179
|
+
# @!attribute [rw] content_policy_units
|
1180
|
+
# The content policy units processed by the guardrail.
|
1181
|
+
# @return [Integer]
|
1182
|
+
#
|
1183
|
+
# @!attribute [rw] word_policy_units
|
1184
|
+
# The word policy units processed by the guardrail.
|
1185
|
+
# @return [Integer]
|
1186
|
+
#
|
1187
|
+
# @!attribute [rw] sensitive_information_policy_units
|
1188
|
+
# The sensitive information policy units processed by the guardrail.
|
1189
|
+
# @return [Integer]
|
1190
|
+
#
|
1191
|
+
# @!attribute [rw] sensitive_information_policy_free_units
|
1192
|
+
# The sensitive information policy free units processed by the
|
1193
|
+
# guardrail.
|
1194
|
+
# @return [Integer]
|
1195
|
+
#
|
1196
|
+
# @!attribute [rw] contextual_grounding_policy_units
|
1197
|
+
# The contextual grounding policy units processed by the guardrail.
|
1198
|
+
# @return [Integer]
|
1199
|
+
#
|
1200
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/GuardrailUsage AWS API Documentation
|
1201
|
+
#
|
1202
|
+
class GuardrailUsage < Struct.new(
|
1203
|
+
:topic_policy_units,
|
1204
|
+
:content_policy_units,
|
1205
|
+
:word_policy_units,
|
1206
|
+
:sensitive_information_policy_units,
|
1207
|
+
:sensitive_information_policy_free_units,
|
1208
|
+
:contextual_grounding_policy_units)
|
1209
|
+
SENSITIVE = []
|
1210
|
+
include Aws::Structure
|
1211
|
+
end
|
1212
|
+
|
980
1213
|
# The word policy assessment.
|
981
1214
|
#
|
982
1215
|
# @!attribute [rw] custom_words
|
@@ -1023,7 +1256,7 @@ module Aws::BedrockRuntime
|
|
1023
1256
|
#
|
1024
1257
|
# @!attribute [rw] bytes
|
1025
1258
|
# The raw image bytes for the image. If you use an AWS SDK, you don't
|
1026
|
-
# need to
|
1259
|
+
# need to encode the image bytes in base64.
|
1027
1260
|
# @return [String]
|
1028
1261
|
#
|
1029
1262
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ImageSource AWS API Documentation
|
@@ -1359,7 +1592,19 @@ module Aws::BedrockRuntime
|
|
1359
1592
|
# @return [String]
|
1360
1593
|
#
|
1361
1594
|
# @!attribute [rw] content
|
1362
|
-
# The message content.
|
1595
|
+
# The message content. Note the following restrictions:
|
1596
|
+
#
|
1597
|
+
# * You can include up to 20 images. Each image's size, height, and
|
1598
|
+
# width must be no more than 3.75 MB, 8000 px, and 8000 px,
|
1599
|
+
# respectively.
|
1600
|
+
#
|
1601
|
+
# * You can include up to five documents. Each document's size must
|
1602
|
+
# be no more than 4.5 MB.
|
1603
|
+
#
|
1604
|
+
# * If you include a `ContentBlock` with a `document` field in the
|
1605
|
+
# array, you must also include a `ContentBlock` with a `text` field.
|
1606
|
+
#
|
1607
|
+
# * You can only include images and documents if the `role` is `user`.
|
1363
1608
|
# @return [Array<Types::ContentBlock>]
|
1364
1609
|
#
|
1365
1610
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/Message AWS API Documentation
|
@@ -1511,9 +1756,14 @@ module Aws::BedrockRuntime
|
|
1511
1756
|
include Aws::Structure
|
1512
1757
|
end
|
1513
1758
|
|
1514
|
-
#
|
1759
|
+
# Your request exceeds the service quota for your account. You can view
|
1760
|
+
# your quotas at [Viewing service quotas][1]. You can resubmit your
|
1515
1761
|
# request later.
|
1516
1762
|
#
|
1763
|
+
#
|
1764
|
+
#
|
1765
|
+
# [1]: https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html
|
1766
|
+
#
|
1517
1767
|
# @!attribute [rw] message
|
1518
1768
|
# @return [String]
|
1519
1769
|
#
|
@@ -1525,6 +1775,20 @@ module Aws::BedrockRuntime
|
|
1525
1775
|
include Aws::Structure
|
1526
1776
|
end
|
1527
1777
|
|
1778
|
+
# The service isn't currently available. Try again later.
|
1779
|
+
#
|
1780
|
+
# @!attribute [rw] message
|
1781
|
+
# @return [String]
|
1782
|
+
#
|
1783
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ServiceUnavailableException AWS API Documentation
|
1784
|
+
#
|
1785
|
+
class ServiceUnavailableException < Struct.new(
|
1786
|
+
:message,
|
1787
|
+
:event_type)
|
1788
|
+
SENSITIVE = []
|
1789
|
+
include Aws::Structure
|
1790
|
+
end
|
1791
|
+
|
1528
1792
|
# The model must request a specific tool. For example, `\{"tool" :
|
1529
1793
|
# \{"name" : "Your tool name"\}\}`.
|
1530
1794
|
#
|
@@ -1553,11 +1817,16 @@ module Aws::BedrockRuntime
|
|
1553
1817
|
# @return [String]
|
1554
1818
|
#
|
1555
1819
|
# @!attribute [rw] guard_content
|
1556
|
-
# A content block to assess with the guardrail. Use with the
|
1557
|
-
#
|
1820
|
+
# A content block to assess with the guardrail. Use with the
|
1821
|
+
# [Converse][1] or [ConverseStream][2] API operations.
|
1558
1822
|
#
|
1559
1823
|
# For more information, see *Use a guardrail with the Converse API* in
|
1560
1824
|
# the *Amazon Bedrock User Guide*.
|
1825
|
+
#
|
1826
|
+
#
|
1827
|
+
#
|
1828
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
|
1829
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
|
1561
1830
|
# @return [Types::GuardrailConverseContentBlock]
|
1562
1831
|
#
|
1563
1832
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/SystemContentBlock AWS API Documentation
|
@@ -1575,7 +1844,14 @@ module Aws::BedrockRuntime
|
|
1575
1844
|
class Unknown < SystemContentBlock; end
|
1576
1845
|
end
|
1577
1846
|
|
1578
|
-
#
|
1847
|
+
# Your request was throttled because of service-wide limitations.
|
1848
|
+
# Resubmit your request later or in a different region. You can also
|
1849
|
+
# purchase [Provisioned Throughput][1] to increase the rate or number of
|
1850
|
+
# tokens you can process.
|
1851
|
+
#
|
1852
|
+
#
|
1853
|
+
#
|
1854
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html
|
1579
1855
|
#
|
1580
1856
|
# @!attribute [rw] message
|
1581
1857
|
# @return [String]
|
@@ -1613,7 +1889,13 @@ module Aws::BedrockRuntime
|
|
1613
1889
|
include Aws::Structure
|
1614
1890
|
end
|
1615
1891
|
|
1616
|
-
# Information about a tool that you can use with the Converse API.
|
1892
|
+
# Information about a tool that you can use with the Converse API. For
|
1893
|
+
# more information, see [Tool use (function calling)][1] in the Amazon
|
1894
|
+
# Bedrock User Guide.
|
1895
|
+
#
|
1896
|
+
#
|
1897
|
+
#
|
1898
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html
|
1617
1899
|
#
|
1618
1900
|
# @note Tool is a union - when making an API calls you must set exactly one of the members.
|
1619
1901
|
#
|
@@ -1671,13 +1953,19 @@ module Aws::BedrockRuntime
|
|
1671
1953
|
class Unknown < ToolChoice; end
|
1672
1954
|
end
|
1673
1955
|
|
1674
|
-
# Configuration information for the tools that you pass to a model.
|
1956
|
+
# Configuration information for the tools that you pass to a model. For
|
1957
|
+
# more information, see [Tool use (function calling)][1] in the Amazon
|
1958
|
+
# Bedrock User Guide.
|
1675
1959
|
#
|
1676
1960
|
# <note markdown="1"> This field is only supported by Anthropic Claude 3, Cohere Command R,
|
1677
1961
|
# Cohere Command R+, and Mistral Large models.
|
1678
1962
|
#
|
1679
1963
|
# </note>
|
1680
1964
|
#
|
1965
|
+
#
|
1966
|
+
#
|
1967
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html
|
1968
|
+
#
|
1681
1969
|
# @!attribute [rw] tools
|
1682
1970
|
# An array of tools that you want to pass to a model.
|
1683
1971
|
# @return [Array<Types::Tool>]
|
@@ -1913,7 +2201,8 @@ module Aws::BedrockRuntime
|
|
1913
2201
|
:internal_server_exception,
|
1914
2202
|
:model_stream_error_exception,
|
1915
2203
|
:validation_exception,
|
1916
|
-
:throttling_exception
|
2204
|
+
:throttling_exception,
|
2205
|
+
:service_unavailable_exception
|
1917
2206
|
]
|
1918
2207
|
end
|
1919
2208
|
|
@@ -1935,7 +2224,8 @@ module Aws::BedrockRuntime
|
|
1935
2224
|
:model_stream_error_exception,
|
1936
2225
|
:validation_exception,
|
1937
2226
|
:throttling_exception,
|
1938
|
-
:model_timeout_exception
|
2227
|
+
:model_timeout_exception,
|
2228
|
+
:service_unavailable_exception
|
1939
2229
|
]
|
1940
2230
|
end
|
1941
2231
|
|
@@ -34,7 +34,7 @@ require_relative 'aws-sdk-bedrockruntime/event_streams'
|
|
34
34
|
# structure.
|
35
35
|
#
|
36
36
|
# bedrock_runtime = Aws::BedrockRuntime::Client.new
|
37
|
-
# resp = bedrock_runtime.
|
37
|
+
# resp = bedrock_runtime.apply_guardrail(params)
|
38
38
|
#
|
39
39
|
# See {Client} for more information.
|
40
40
|
#
|
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-bedrockruntime/event_streams'
|
|
54
54
|
# @!group service
|
55
55
|
module Aws::BedrockRuntime
|
56
56
|
|
57
|
-
GEM_VERSION = '1.
|
57
|
+
GEM_VERSION = '1.17.0'
|
58
58
|
|
59
59
|
end
|