aws-sdk-bedrockruntime 1.15.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44ad8c5daa358580d3658e10ec3891b2757e92fd44ef6e6c696fa7fb2a421759
4
- data.tar.gz: 4ade4c1767036c0894a618e3e04bb0a6b2330d7fefd565580b3437d577b69567
3
+ metadata.gz: 7d9aaed2520eafc32d768c6641145a47f146fbc96cc1282c1025131cc9f50c48
4
+ data.tar.gz: e255962e70aeb7051db7f7f57d0e0a74d6397e58b977622bf3061cd18e411485
5
5
  SHA512:
6
- metadata.gz: 22a3b581362ed695d11d5097ab22e3fd190062abad919a844801e93fb4935a532dd380b8665c9add0e6787417647bf31d3fc8dac2dda244ad6bcf92a36256674
7
- data.tar.gz: 37084725d280adceb4a181e146c17827fea7abd2bdee052be59f94965daf49a0af5095e8e3f57419b58419a1d9f1dccd28f90579d216a92b460dbd9406a892da
6
+ metadata.gz: c69fb53793f6ef1ba152dbac64d19289f835dc156231161deb3d13d761bba8a01666810bf294169a54050bd99a2243f2a2715da515259ed91f66fc88dd96f099
7
+ data.tar.gz: 48508ec3fa2435c70613511927e3681105bcbe2aa1b04d6b2d7284c890ddc6a191349f673bc8a721fd7634985596230415427174d561d137b105c164b79a6d32
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.16.0 (2024-07-10)
5
+ ------------------
6
+
7
+ * Feature - Add support for contextual grounding check and ApplyGuardrail API for Guardrails for Amazon Bedrock.
8
+
4
9
  1.15.0 (2024-07-02)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.15.0
1
+ 1.16.0
@@ -436,6 +436,94 @@ module Aws::BedrockRuntime
436
436
 
437
437
  # @!group API Operations
438
438
 
439
+ # The action to apply a guardrail.
440
+ #
441
+ # @option params [required, String] :guardrail_identifier
442
+ # The guardrail identifier used in the request to apply the guardrail.
443
+ #
444
+ # @option params [required, String] :guardrail_version
445
+ # The guardrail version used in the request to apply the guardrail.
446
+ #
447
+ # @option params [required, String] :source
448
+ # The source of data used in the request to apply the guardrail.
449
+ #
450
+ # @option params [required, Array<Types::GuardrailContentBlock>] :content
451
+ # The content details used in the request to apply the guardrail.
452
+ #
453
+ # @return [Types::ApplyGuardrailResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
454
+ #
455
+ # * {Types::ApplyGuardrailResponse#usage #usage} => Types::GuardrailUsage
456
+ # * {Types::ApplyGuardrailResponse#action #action} => String
457
+ # * {Types::ApplyGuardrailResponse#outputs #outputs} => Array&lt;Types::GuardrailOutputContent&gt;
458
+ # * {Types::ApplyGuardrailResponse#assessments #assessments} => Array&lt;Types::GuardrailAssessment&gt;
459
+ #
460
+ # @example Request syntax with placeholder values
461
+ #
462
+ # resp = client.apply_guardrail({
463
+ # guardrail_identifier: "GuardrailIdentifier", # required
464
+ # guardrail_version: "GuardrailVersion", # required
465
+ # source: "INPUT", # required, accepts INPUT, OUTPUT
466
+ # content: [ # required
467
+ # {
468
+ # text: {
469
+ # text: "String", # required
470
+ # qualifiers: ["grounding_source"], # accepts grounding_source, query, guard_content
471
+ # },
472
+ # },
473
+ # ],
474
+ # })
475
+ #
476
+ # @example Response structure
477
+ #
478
+ # resp.usage.topic_policy_units #=> Integer
479
+ # resp.usage.content_policy_units #=> Integer
480
+ # resp.usage.word_policy_units #=> Integer
481
+ # resp.usage.sensitive_information_policy_units #=> Integer
482
+ # resp.usage.sensitive_information_policy_free_units #=> Integer
483
+ # resp.usage.contextual_grounding_policy_units #=> Integer
484
+ # resp.action #=> String, one of "NONE", "GUARDRAIL_INTERVENED"
485
+ # resp.outputs #=> Array
486
+ # resp.outputs[0].text #=> String
487
+ # resp.assessments #=> Array
488
+ # resp.assessments[0].topic_policy.topics #=> Array
489
+ # resp.assessments[0].topic_policy.topics[0].name #=> String
490
+ # resp.assessments[0].topic_policy.topics[0].type #=> String, one of "DENY"
491
+ # resp.assessments[0].topic_policy.topics[0].action #=> String, one of "BLOCKED"
492
+ # resp.assessments[0].content_policy.filters #=> Array
493
+ # resp.assessments[0].content_policy.filters[0].type #=> String, one of "INSULTS", "HATE", "SEXUAL", "VIOLENCE", "MISCONDUCT", "PROMPT_ATTACK"
494
+ # resp.assessments[0].content_policy.filters[0].confidence #=> String, one of "NONE", "LOW", "MEDIUM", "HIGH"
495
+ # resp.assessments[0].content_policy.filters[0].action #=> String, one of "BLOCKED"
496
+ # resp.assessments[0].word_policy.custom_words #=> Array
497
+ # resp.assessments[0].word_policy.custom_words[0].match #=> String
498
+ # resp.assessments[0].word_policy.custom_words[0].action #=> String, one of "BLOCKED"
499
+ # resp.assessments[0].word_policy.managed_word_lists #=> Array
500
+ # resp.assessments[0].word_policy.managed_word_lists[0].match #=> String
501
+ # resp.assessments[0].word_policy.managed_word_lists[0].type #=> String, one of "PROFANITY"
502
+ # resp.assessments[0].word_policy.managed_word_lists[0].action #=> String, one of "BLOCKED"
503
+ # resp.assessments[0].sensitive_information_policy.pii_entities #=> Array
504
+ # resp.assessments[0].sensitive_information_policy.pii_entities[0].match #=> String
505
+ # resp.assessments[0].sensitive_information_policy.pii_entities[0].type #=> String, one of "ADDRESS", "AGE", "AWS_ACCESS_KEY", "AWS_SECRET_KEY", "CA_HEALTH_NUMBER", "CA_SOCIAL_INSURANCE_NUMBER", "CREDIT_DEBIT_CARD_CVV", "CREDIT_DEBIT_CARD_EXPIRY", "CREDIT_DEBIT_CARD_NUMBER", "DRIVER_ID", "EMAIL", "INTERNATIONAL_BANK_ACCOUNT_NUMBER", "IP_ADDRESS", "LICENSE_PLATE", "MAC_ADDRESS", "NAME", "PASSWORD", "PHONE", "PIN", "SWIFT_CODE", "UK_NATIONAL_HEALTH_SERVICE_NUMBER", "UK_NATIONAL_INSURANCE_NUMBER", "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER", "URL", "USERNAME", "US_BANK_ACCOUNT_NUMBER", "US_BANK_ROUTING_NUMBER", "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER", "US_PASSPORT_NUMBER", "US_SOCIAL_SECURITY_NUMBER", "VEHICLE_IDENTIFICATION_NUMBER"
506
+ # resp.assessments[0].sensitive_information_policy.pii_entities[0].action #=> String, one of "ANONYMIZED", "BLOCKED"
507
+ # resp.assessments[0].sensitive_information_policy.regexes #=> Array
508
+ # resp.assessments[0].sensitive_information_policy.regexes[0].name #=> String
509
+ # resp.assessments[0].sensitive_information_policy.regexes[0].match #=> String
510
+ # resp.assessments[0].sensitive_information_policy.regexes[0].regex #=> String
511
+ # resp.assessments[0].sensitive_information_policy.regexes[0].action #=> String, one of "ANONYMIZED", "BLOCKED"
512
+ # resp.assessments[0].contextual_grounding_policy.filters #=> Array
513
+ # resp.assessments[0].contextual_grounding_policy.filters[0].type #=> String, one of "GROUNDING", "RELEVANCE"
514
+ # resp.assessments[0].contextual_grounding_policy.filters[0].threshold #=> Float
515
+ # resp.assessments[0].contextual_grounding_policy.filters[0].score #=> Float
516
+ # resp.assessments[0].contextual_grounding_policy.filters[0].action #=> String, one of "BLOCKED", "NONE"
517
+ #
518
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ApplyGuardrail AWS API Documentation
519
+ #
520
+ # @overload apply_guardrail(params = {})
521
+ # @param [Hash] params ({})
522
+ def apply_guardrail(params = {}, options = {})
523
+ req = build_request(:apply_guardrail, params)
524
+ req.send_request(options)
525
+ end
526
+
439
527
  # Sends messages to the specified Amazon Bedrock model. `Converse`
440
528
  # provides a consistent interface that works with all models that
441
529
  # support messages. This allows you to write code once and use it with
@@ -603,6 +691,7 @@ module Aws::BedrockRuntime
603
691
  # guard_content: {
604
692
  # text: {
605
693
  # text: "String", # required
694
+ # qualifiers: ["grounding_source"], # accepts grounding_source, query, guard_content
606
695
  # },
607
696
  # },
608
697
  # },
@@ -615,6 +704,7 @@ module Aws::BedrockRuntime
615
704
  # guard_content: {
616
705
  # text: {
617
706
  # text: "String", # required
707
+ # qualifiers: ["grounding_source"], # accepts grounding_source, query, guard_content
618
708
  # },
619
709
  # },
620
710
  # },
@@ -680,6 +770,8 @@ module Aws::BedrockRuntime
680
770
  # resp.output.message.content[0].tool_result.content[0].document.source.bytes #=> String
681
771
  # resp.output.message.content[0].tool_result.status #=> String, one of "success", "error"
682
772
  # resp.output.message.content[0].guard_content.text.text #=> String
773
+ # resp.output.message.content[0].guard_content.text.qualifiers #=> Array
774
+ # resp.output.message.content[0].guard_content.text.qualifiers[0] #=> String, one of "grounding_source", "query", "guard_content"
683
775
  # resp.stop_reason #=> String, one of "end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered"
684
776
  # resp.usage.input_tokens #=> Integer
685
777
  # resp.usage.output_tokens #=> Integer
@@ -712,6 +804,11 @@ module Aws::BedrockRuntime
712
804
  # resp.trace.guardrail.input_assessment["String"].sensitive_information_policy.regexes[0].match #=> String
713
805
  # resp.trace.guardrail.input_assessment["String"].sensitive_information_policy.regexes[0].regex #=> String
714
806
  # resp.trace.guardrail.input_assessment["String"].sensitive_information_policy.regexes[0].action #=> String, one of "ANONYMIZED", "BLOCKED"
807
+ # resp.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters #=> Array
808
+ # resp.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].type #=> String, one of "GROUNDING", "RELEVANCE"
809
+ # resp.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].threshold #=> Float
810
+ # resp.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].score #=> Float
811
+ # resp.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].action #=> String, one of "BLOCKED", "NONE"
715
812
  # resp.trace.guardrail.output_assessments #=> Hash
716
813
  # resp.trace.guardrail.output_assessments["String"] #=> Array
717
814
  # resp.trace.guardrail.output_assessments["String"][0].topic_policy.topics #=> Array
@@ -738,6 +835,11 @@ module Aws::BedrockRuntime
738
835
  # resp.trace.guardrail.output_assessments["String"][0].sensitive_information_policy.regexes[0].match #=> String
739
836
  # resp.trace.guardrail.output_assessments["String"][0].sensitive_information_policy.regexes[0].regex #=> String
740
837
  # resp.trace.guardrail.output_assessments["String"][0].sensitive_information_policy.regexes[0].action #=> String, one of "ANONYMIZED", "BLOCKED"
838
+ # resp.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters #=> Array
839
+ # resp.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].type #=> String, one of "GROUNDING", "RELEVANCE"
840
+ # resp.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].threshold #=> Float
841
+ # resp.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].score #=> Float
842
+ # resp.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].action #=> String, one of "BLOCKED", "NONE"
741
843
  #
742
844
  # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/Converse AWS API Documentation
743
845
  #
@@ -1077,6 +1179,7 @@ module Aws::BedrockRuntime
1077
1179
  # guard_content: {
1078
1180
  # text: {
1079
1181
  # text: "String", # required
1182
+ # qualifiers: ["grounding_source"], # accepts grounding_source, query, guard_content
1080
1183
  # },
1081
1184
  # },
1082
1185
  # },
@@ -1089,6 +1192,7 @@ module Aws::BedrockRuntime
1089
1192
  # guard_content: {
1090
1193
  # text: {
1091
1194
  # text: "String", # required
1195
+ # qualifiers: ["grounding_source"], # accepts grounding_source, query, guard_content
1092
1196
  # },
1093
1197
  # },
1094
1198
  # },
@@ -1190,6 +1294,11 @@ module Aws::BedrockRuntime
1190
1294
  # event.trace.guardrail.input_assessment["String"].sensitive_information_policy.regexes[0].match #=> String
1191
1295
  # event.trace.guardrail.input_assessment["String"].sensitive_information_policy.regexes[0].regex #=> String
1192
1296
  # event.trace.guardrail.input_assessment["String"].sensitive_information_policy.regexes[0].action #=> String, one of "ANONYMIZED", "BLOCKED"
1297
+ # event.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters #=> Array
1298
+ # event.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].type #=> String, one of "GROUNDING", "RELEVANCE"
1299
+ # event.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].threshold #=> Float
1300
+ # event.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].score #=> Float
1301
+ # event.trace.guardrail.input_assessment["String"].contextual_grounding_policy.filters[0].action #=> String, one of "BLOCKED", "NONE"
1193
1302
  # event.trace.guardrail.output_assessments #=> Hash
1194
1303
  # event.trace.guardrail.output_assessments["String"] #=> Array
1195
1304
  # event.trace.guardrail.output_assessments["String"][0].topic_policy.topics #=> Array
@@ -1216,6 +1325,11 @@ module Aws::BedrockRuntime
1216
1325
  # event.trace.guardrail.output_assessments["String"][0].sensitive_information_policy.regexes[0].match #=> String
1217
1326
  # event.trace.guardrail.output_assessments["String"][0].sensitive_information_policy.regexes[0].regex #=> String
1218
1327
  # event.trace.guardrail.output_assessments["String"][0].sensitive_information_policy.regexes[0].action #=> String, one of "ANONYMIZED", "BLOCKED"
1328
+ # event.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters #=> Array
1329
+ # event.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].type #=> String, one of "GROUNDING", "RELEVANCE"
1330
+ # event.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].threshold #=> Float
1331
+ # event.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].score #=> Float
1332
+ # event.trace.guardrail.output_assessments["String"][0].contextual_grounding_policy.filters[0].action #=> String, one of "BLOCKED", "NONE"
1219
1333
  #
1220
1334
  # For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
1221
1335
  # event.message #=> String
@@ -1665,7 +1779,7 @@ module Aws::BedrockRuntime
1665
1779
  params: params,
1666
1780
  config: config)
1667
1781
  context[:gem_name] = 'aws-sdk-bedrockruntime'
1668
- context[:gem_version] = '1.15.0'
1782
+ context[:gem_version] = '1.16.0'
1669
1783
  Seahorse::Client::Request.new(handlers, context)
1670
1784
  end
1671
1785
 
@@ -15,6 +15,8 @@ module Aws::BedrockRuntime
15
15
 
16
16
  AccessDeniedException = Shapes::StructureShape.new(name: 'AccessDeniedException')
17
17
  AnyToolChoice = Shapes::StructureShape.new(name: 'AnyToolChoice')
18
+ ApplyGuardrailRequest = Shapes::StructureShape.new(name: 'ApplyGuardrailRequest')
19
+ ApplyGuardrailResponse = Shapes::StructureShape.new(name: 'ApplyGuardrailResponse')
18
20
  AutoToolChoice = Shapes::StructureShape.new(name: 'AutoToolChoice')
19
21
  Body = Shapes::BlobShape.new(name: 'Body')
20
22
  ContentBlock = Shapes::UnionShape.new(name: 'ContentBlock')
@@ -47,18 +49,35 @@ module Aws::BedrockRuntime
47
49
  DocumentFormat = Shapes::StringShape.new(name: 'DocumentFormat')
48
50
  DocumentSource = Shapes::UnionShape.new(name: 'DocumentSource')
49
51
  DocumentSourceBytesBlob = Shapes::BlobShape.new(name: 'DocumentSourceBytesBlob')
52
+ GuardrailAction = Shapes::StringShape.new(name: 'GuardrailAction')
50
53
  GuardrailAssessment = Shapes::StructureShape.new(name: 'GuardrailAssessment')
51
54
  GuardrailAssessmentList = Shapes::ListShape.new(name: 'GuardrailAssessmentList')
52
55
  GuardrailAssessmentListMap = Shapes::MapShape.new(name: 'GuardrailAssessmentListMap')
53
56
  GuardrailAssessmentMap = Shapes::MapShape.new(name: 'GuardrailAssessmentMap')
54
57
  GuardrailConfiguration = Shapes::StructureShape.new(name: 'GuardrailConfiguration')
58
+ GuardrailContentBlock = Shapes::UnionShape.new(name: 'GuardrailContentBlock')
59
+ GuardrailContentBlockList = Shapes::ListShape.new(name: 'GuardrailContentBlockList')
55
60
  GuardrailContentFilter = Shapes::StructureShape.new(name: 'GuardrailContentFilter')
56
61
  GuardrailContentFilterConfidence = Shapes::StringShape.new(name: 'GuardrailContentFilterConfidence')
57
62
  GuardrailContentFilterList = Shapes::ListShape.new(name: 'GuardrailContentFilterList')
58
63
  GuardrailContentFilterType = Shapes::StringShape.new(name: 'GuardrailContentFilterType')
59
64
  GuardrailContentPolicyAction = Shapes::StringShape.new(name: 'GuardrailContentPolicyAction')
60
65
  GuardrailContentPolicyAssessment = Shapes::StructureShape.new(name: 'GuardrailContentPolicyAssessment')
66
+ GuardrailContentPolicyUnitsProcessed = Shapes::IntegerShape.new(name: 'GuardrailContentPolicyUnitsProcessed')
67
+ GuardrailContentQualifier = Shapes::StringShape.new(name: 'GuardrailContentQualifier')
68
+ GuardrailContentQualifierList = Shapes::ListShape.new(name: 'GuardrailContentQualifierList')
69
+ GuardrailContentSource = Shapes::StringShape.new(name: 'GuardrailContentSource')
70
+ GuardrailContextualGroundingFilter = Shapes::StructureShape.new(name: 'GuardrailContextualGroundingFilter')
71
+ GuardrailContextualGroundingFilterScoreDouble = Shapes::FloatShape.new(name: 'GuardrailContextualGroundingFilterScoreDouble')
72
+ GuardrailContextualGroundingFilterThresholdDouble = Shapes::FloatShape.new(name: 'GuardrailContextualGroundingFilterThresholdDouble')
73
+ GuardrailContextualGroundingFilterType = Shapes::StringShape.new(name: 'GuardrailContextualGroundingFilterType')
74
+ GuardrailContextualGroundingFilters = Shapes::ListShape.new(name: 'GuardrailContextualGroundingFilters')
75
+ GuardrailContextualGroundingPolicyAction = Shapes::StringShape.new(name: 'GuardrailContextualGroundingPolicyAction')
76
+ GuardrailContextualGroundingPolicyAssessment = Shapes::StructureShape.new(name: 'GuardrailContextualGroundingPolicyAssessment')
77
+ GuardrailContextualGroundingPolicyUnitsProcessed = Shapes::IntegerShape.new(name: 'GuardrailContextualGroundingPolicyUnitsProcessed')
61
78
  GuardrailConverseContentBlock = Shapes::UnionShape.new(name: 'GuardrailConverseContentBlock')
79
+ GuardrailConverseContentQualifier = Shapes::StringShape.new(name: 'GuardrailConverseContentQualifier')
80
+ GuardrailConverseContentQualifierList = Shapes::ListShape.new(name: 'GuardrailConverseContentQualifierList')
62
81
  GuardrailConverseTextBlock = Shapes::StructureShape.new(name: 'GuardrailConverseTextBlock')
63
82
  GuardrailCustomWord = Shapes::StructureShape.new(name: 'GuardrailCustomWord')
64
83
  GuardrailCustomWordList = Shapes::ListShape.new(name: 'GuardrailCustomWordList')
@@ -66,6 +85,8 @@ module Aws::BedrockRuntime
66
85
  GuardrailManagedWord = Shapes::StructureShape.new(name: 'GuardrailManagedWord')
67
86
  GuardrailManagedWordList = Shapes::ListShape.new(name: 'GuardrailManagedWordList')
68
87
  GuardrailManagedWordType = Shapes::StringShape.new(name: 'GuardrailManagedWordType')
88
+ GuardrailOutputContent = Shapes::StructureShape.new(name: 'GuardrailOutputContent')
89
+ GuardrailOutputContentList = Shapes::ListShape.new(name: 'GuardrailOutputContentList')
69
90
  GuardrailOutputText = Shapes::StringShape.new(name: 'GuardrailOutputText')
70
91
  GuardrailPiiEntityFilter = Shapes::StructureShape.new(name: 'GuardrailPiiEntityFilter')
71
92
  GuardrailPiiEntityFilterList = Shapes::ListShape.new(name: 'GuardrailPiiEntityFilterList')
@@ -74,18 +95,24 @@ module Aws::BedrockRuntime
74
95
  GuardrailRegexFilterList = Shapes::ListShape.new(name: 'GuardrailRegexFilterList')
75
96
  GuardrailSensitiveInformationPolicyAction = Shapes::StringShape.new(name: 'GuardrailSensitiveInformationPolicyAction')
76
97
  GuardrailSensitiveInformationPolicyAssessment = Shapes::StructureShape.new(name: 'GuardrailSensitiveInformationPolicyAssessment')
98
+ GuardrailSensitiveInformationPolicyFreeUnitsProcessed = Shapes::IntegerShape.new(name: 'GuardrailSensitiveInformationPolicyFreeUnitsProcessed')
99
+ GuardrailSensitiveInformationPolicyUnitsProcessed = Shapes::IntegerShape.new(name: 'GuardrailSensitiveInformationPolicyUnitsProcessed')
77
100
  GuardrailStreamConfiguration = Shapes::StructureShape.new(name: 'GuardrailStreamConfiguration')
78
101
  GuardrailStreamProcessingMode = Shapes::StringShape.new(name: 'GuardrailStreamProcessingMode')
102
+ GuardrailTextBlock = Shapes::StructureShape.new(name: 'GuardrailTextBlock')
79
103
  GuardrailTopic = Shapes::StructureShape.new(name: 'GuardrailTopic')
80
104
  GuardrailTopicList = Shapes::ListShape.new(name: 'GuardrailTopicList')
81
105
  GuardrailTopicPolicyAction = Shapes::StringShape.new(name: 'GuardrailTopicPolicyAction')
82
106
  GuardrailTopicPolicyAssessment = Shapes::StructureShape.new(name: 'GuardrailTopicPolicyAssessment')
107
+ GuardrailTopicPolicyUnitsProcessed = Shapes::IntegerShape.new(name: 'GuardrailTopicPolicyUnitsProcessed')
83
108
  GuardrailTopicType = Shapes::StringShape.new(name: 'GuardrailTopicType')
84
109
  GuardrailTrace = Shapes::StringShape.new(name: 'GuardrailTrace')
85
110
  GuardrailTraceAssessment = Shapes::StructureShape.new(name: 'GuardrailTraceAssessment')
111
+ GuardrailUsage = Shapes::StructureShape.new(name: 'GuardrailUsage')
86
112
  GuardrailVersion = Shapes::StringShape.new(name: 'GuardrailVersion')
87
113
  GuardrailWordPolicyAction = Shapes::StringShape.new(name: 'GuardrailWordPolicyAction')
88
114
  GuardrailWordPolicyAssessment = Shapes::StructureShape.new(name: 'GuardrailWordPolicyAssessment')
115
+ GuardrailWordPolicyUnitsProcessed = Shapes::IntegerShape.new(name: 'GuardrailWordPolicyUnitsProcessed')
89
116
  ImageBlock = Shapes::StructureShape.new(name: 'ImageBlock')
90
117
  ImageFormat = Shapes::StringShape.new(name: 'ImageFormat')
91
118
  ImageSource = Shapes::UnionShape.new(name: 'ImageSource')
@@ -154,6 +181,18 @@ module Aws::BedrockRuntime
154
181
 
155
182
  AnyToolChoice.struct_class = Types::AnyToolChoice
156
183
 
184
+ ApplyGuardrailRequest.add_member(:guardrail_identifier, Shapes::ShapeRef.new(shape: GuardrailIdentifier, required: true, location: "uri", location_name: "guardrailIdentifier"))
185
+ ApplyGuardrailRequest.add_member(:guardrail_version, Shapes::ShapeRef.new(shape: GuardrailVersion, required: true, location: "uri", location_name: "guardrailVersion"))
186
+ ApplyGuardrailRequest.add_member(:source, Shapes::ShapeRef.new(shape: GuardrailContentSource, required: true, location_name: "source"))
187
+ ApplyGuardrailRequest.add_member(:content, Shapes::ShapeRef.new(shape: GuardrailContentBlockList, required: true, location_name: "content"))
188
+ ApplyGuardrailRequest.struct_class = Types::ApplyGuardrailRequest
189
+
190
+ ApplyGuardrailResponse.add_member(:usage, Shapes::ShapeRef.new(shape: GuardrailUsage, required: true, location_name: "usage"))
191
+ ApplyGuardrailResponse.add_member(:action, Shapes::ShapeRef.new(shape: GuardrailAction, required: true, location_name: "action"))
192
+ ApplyGuardrailResponse.add_member(:outputs, Shapes::ShapeRef.new(shape: GuardrailOutputContentList, required: true, location_name: "outputs"))
193
+ ApplyGuardrailResponse.add_member(:assessments, Shapes::ShapeRef.new(shape: GuardrailAssessmentList, required: true, location_name: "assessments"))
194
+ ApplyGuardrailResponse.struct_class = Types::ApplyGuardrailResponse
195
+
157
196
  AutoToolChoice.struct_class = Types::AutoToolChoice
158
197
 
159
198
  ContentBlock.add_member(:text, Shapes::ShapeRef.new(shape: String, location_name: "text"))
@@ -286,6 +325,7 @@ module Aws::BedrockRuntime
286
325
  GuardrailAssessment.add_member(:content_policy, Shapes::ShapeRef.new(shape: GuardrailContentPolicyAssessment, location_name: "contentPolicy"))
287
326
  GuardrailAssessment.add_member(:word_policy, Shapes::ShapeRef.new(shape: GuardrailWordPolicyAssessment, location_name: "wordPolicy"))
288
327
  GuardrailAssessment.add_member(:sensitive_information_policy, Shapes::ShapeRef.new(shape: GuardrailSensitiveInformationPolicyAssessment, location_name: "sensitiveInformationPolicy"))
328
+ GuardrailAssessment.add_member(:contextual_grounding_policy, Shapes::ShapeRef.new(shape: GuardrailContextualGroundingPolicyAssessment, location_name: "contextualGroundingPolicy"))
289
329
  GuardrailAssessment.struct_class = Types::GuardrailAssessment
290
330
 
291
331
  GuardrailAssessmentList.member = Shapes::ShapeRef.new(shape: GuardrailAssessment)
@@ -301,6 +341,14 @@ module Aws::BedrockRuntime
301
341
  GuardrailConfiguration.add_member(:trace, Shapes::ShapeRef.new(shape: GuardrailTrace, location_name: "trace"))
302
342
  GuardrailConfiguration.struct_class = Types::GuardrailConfiguration
303
343
 
344
+ GuardrailContentBlock.add_member(:text, Shapes::ShapeRef.new(shape: GuardrailTextBlock, location_name: "text"))
345
+ GuardrailContentBlock.add_member(:unknown, Shapes::ShapeRef.new(shape: nil, location_name: 'unknown'))
346
+ GuardrailContentBlock.add_member_subclass(:text, Types::GuardrailContentBlock::Text)
347
+ GuardrailContentBlock.add_member_subclass(:unknown, Types::GuardrailContentBlock::Unknown)
348
+ GuardrailContentBlock.struct_class = Types::GuardrailContentBlock
349
+
350
+ GuardrailContentBlockList.member = Shapes::ShapeRef.new(shape: GuardrailContentBlock)
351
+
304
352
  GuardrailContentFilter.add_member(:type, Shapes::ShapeRef.new(shape: GuardrailContentFilterType, required: true, location_name: "type"))
305
353
  GuardrailContentFilter.add_member(:confidence, Shapes::ShapeRef.new(shape: GuardrailContentFilterConfidence, required: true, location_name: "confidence"))
306
354
  GuardrailContentFilter.add_member(:action, Shapes::ShapeRef.new(shape: GuardrailContentPolicyAction, required: true, location_name: "action"))
@@ -311,13 +359,29 @@ module Aws::BedrockRuntime
311
359
  GuardrailContentPolicyAssessment.add_member(:filters, Shapes::ShapeRef.new(shape: GuardrailContentFilterList, required: true, location_name: "filters"))
312
360
  GuardrailContentPolicyAssessment.struct_class = Types::GuardrailContentPolicyAssessment
313
361
 
362
+ GuardrailContentQualifierList.member = Shapes::ShapeRef.new(shape: GuardrailContentQualifier)
363
+
364
+ GuardrailContextualGroundingFilter.add_member(:type, Shapes::ShapeRef.new(shape: GuardrailContextualGroundingFilterType, required: true, location_name: "type"))
365
+ GuardrailContextualGroundingFilter.add_member(:threshold, Shapes::ShapeRef.new(shape: GuardrailContextualGroundingFilterThresholdDouble, required: true, location_name: "threshold"))
366
+ GuardrailContextualGroundingFilter.add_member(:score, Shapes::ShapeRef.new(shape: GuardrailContextualGroundingFilterScoreDouble, required: true, location_name: "score"))
367
+ GuardrailContextualGroundingFilter.add_member(:action, Shapes::ShapeRef.new(shape: GuardrailContextualGroundingPolicyAction, required: true, location_name: "action"))
368
+ GuardrailContextualGroundingFilter.struct_class = Types::GuardrailContextualGroundingFilter
369
+
370
+ GuardrailContextualGroundingFilters.member = Shapes::ShapeRef.new(shape: GuardrailContextualGroundingFilter)
371
+
372
+ GuardrailContextualGroundingPolicyAssessment.add_member(:filters, Shapes::ShapeRef.new(shape: GuardrailContextualGroundingFilters, location_name: "filters"))
373
+ GuardrailContextualGroundingPolicyAssessment.struct_class = Types::GuardrailContextualGroundingPolicyAssessment
374
+
314
375
  GuardrailConverseContentBlock.add_member(:text, Shapes::ShapeRef.new(shape: GuardrailConverseTextBlock, location_name: "text"))
315
376
  GuardrailConverseContentBlock.add_member(:unknown, Shapes::ShapeRef.new(shape: nil, location_name: 'unknown'))
316
377
  GuardrailConverseContentBlock.add_member_subclass(:text, Types::GuardrailConverseContentBlock::Text)
317
378
  GuardrailConverseContentBlock.add_member_subclass(:unknown, Types::GuardrailConverseContentBlock::Unknown)
318
379
  GuardrailConverseContentBlock.struct_class = Types::GuardrailConverseContentBlock
319
380
 
381
+ GuardrailConverseContentQualifierList.member = Shapes::ShapeRef.new(shape: GuardrailConverseContentQualifier)
382
+
320
383
  GuardrailConverseTextBlock.add_member(:text, Shapes::ShapeRef.new(shape: String, required: true, location_name: "text"))
384
+ GuardrailConverseTextBlock.add_member(:qualifiers, Shapes::ShapeRef.new(shape: GuardrailConverseContentQualifierList, location_name: "qualifiers"))
321
385
  GuardrailConverseTextBlock.struct_class = Types::GuardrailConverseTextBlock
322
386
 
323
387
  GuardrailCustomWord.add_member(:match, Shapes::ShapeRef.new(shape: String, required: true, location_name: "match"))
@@ -333,6 +397,11 @@ module Aws::BedrockRuntime
333
397
 
334
398
  GuardrailManagedWordList.member = Shapes::ShapeRef.new(shape: GuardrailManagedWord)
335
399
 
400
+ GuardrailOutputContent.add_member(:text, Shapes::ShapeRef.new(shape: GuardrailOutputText, location_name: "text"))
401
+ GuardrailOutputContent.struct_class = Types::GuardrailOutputContent
402
+
403
+ GuardrailOutputContentList.member = Shapes::ShapeRef.new(shape: GuardrailOutputContent)
404
+
336
405
  GuardrailPiiEntityFilter.add_member(:match, Shapes::ShapeRef.new(shape: String, required: true, location_name: "match"))
337
406
  GuardrailPiiEntityFilter.add_member(:type, Shapes::ShapeRef.new(shape: GuardrailPiiEntityType, required: true, location_name: "type"))
338
407
  GuardrailPiiEntityFilter.add_member(:action, Shapes::ShapeRef.new(shape: GuardrailSensitiveInformationPolicyAction, required: true, location_name: "action"))
@@ -358,6 +427,10 @@ module Aws::BedrockRuntime
358
427
  GuardrailStreamConfiguration.add_member(:stream_processing_mode, Shapes::ShapeRef.new(shape: GuardrailStreamProcessingMode, location_name: "streamProcessingMode"))
359
428
  GuardrailStreamConfiguration.struct_class = Types::GuardrailStreamConfiguration
360
429
 
430
+ GuardrailTextBlock.add_member(:text, Shapes::ShapeRef.new(shape: String, required: true, location_name: "text"))
431
+ GuardrailTextBlock.add_member(:qualifiers, Shapes::ShapeRef.new(shape: GuardrailContentQualifierList, location_name: "qualifiers"))
432
+ GuardrailTextBlock.struct_class = Types::GuardrailTextBlock
433
+
361
434
  GuardrailTopic.add_member(:name, Shapes::ShapeRef.new(shape: String, required: true, location_name: "name"))
362
435
  GuardrailTopic.add_member(:type, Shapes::ShapeRef.new(shape: GuardrailTopicType, required: true, location_name: "type"))
363
436
  GuardrailTopic.add_member(:action, Shapes::ShapeRef.new(shape: GuardrailTopicPolicyAction, required: true, location_name: "action"))
@@ -373,6 +446,14 @@ module Aws::BedrockRuntime
373
446
  GuardrailTraceAssessment.add_member(:output_assessments, Shapes::ShapeRef.new(shape: GuardrailAssessmentListMap, location_name: "outputAssessments"))
374
447
  GuardrailTraceAssessment.struct_class = Types::GuardrailTraceAssessment
375
448
 
449
+ GuardrailUsage.add_member(:topic_policy_units, Shapes::ShapeRef.new(shape: GuardrailTopicPolicyUnitsProcessed, required: true, location_name: "topicPolicyUnits"))
450
+ GuardrailUsage.add_member(:content_policy_units, Shapes::ShapeRef.new(shape: GuardrailContentPolicyUnitsProcessed, required: true, location_name: "contentPolicyUnits"))
451
+ GuardrailUsage.add_member(:word_policy_units, Shapes::ShapeRef.new(shape: GuardrailWordPolicyUnitsProcessed, required: true, location_name: "wordPolicyUnits"))
452
+ GuardrailUsage.add_member(:sensitive_information_policy_units, Shapes::ShapeRef.new(shape: GuardrailSensitiveInformationPolicyUnitsProcessed, required: true, location_name: "sensitiveInformationPolicyUnits"))
453
+ GuardrailUsage.add_member(:sensitive_information_policy_free_units, Shapes::ShapeRef.new(shape: GuardrailSensitiveInformationPolicyFreeUnitsProcessed, required: true, location_name: "sensitiveInformationPolicyFreeUnits"))
454
+ GuardrailUsage.add_member(:contextual_grounding_policy_units, Shapes::ShapeRef.new(shape: GuardrailContextualGroundingPolicyUnitsProcessed, required: true, location_name: "contextualGroundingPolicyUnits"))
455
+ GuardrailUsage.struct_class = Types::GuardrailUsage
456
+
376
457
  GuardrailWordPolicyAssessment.add_member(:custom_words, Shapes::ShapeRef.new(shape: GuardrailCustomWordList, required: true, location_name: "customWords"))
377
458
  GuardrailWordPolicyAssessment.add_member(:managed_word_lists, Shapes::ShapeRef.new(shape: GuardrailManagedWordList, required: true, location_name: "managedWordLists"))
378
459
  GuardrailWordPolicyAssessment.struct_class = Types::GuardrailWordPolicyAssessment
@@ -586,6 +667,20 @@ module Aws::BedrockRuntime
586
667
  "uid" => "bedrock-runtime-2023-09-30",
587
668
  }
588
669
 
670
+ api.add_operation(:apply_guardrail, Seahorse::Model::Operation.new.tap do |o|
671
+ o.name = "ApplyGuardrail"
672
+ o.http_method = "POST"
673
+ o.http_request_uri = "/guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply"
674
+ o.input = Shapes::ShapeRef.new(shape: ApplyGuardrailRequest)
675
+ o.output = Shapes::ShapeRef.new(shape: ApplyGuardrailResponse)
676
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
677
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
678
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
679
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
680
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
681
+ o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
682
+ end)
683
+
589
684
  api.add_operation(:converse, Seahorse::Model::Operation.new.tap do |o|
590
685
  o.name = "Converse"
591
686
  o.http_method = "POST"
@@ -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
@@ -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 API (Converse and ConverseStream).
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 contains
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, you can
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 only
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 when sending a [Converse][1] or
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 the document included in a message when
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
- # A base64-encoded string of a UTF-8 encoded file, that is the
619
- # document to include in the message.
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 action.
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
- # A content block for selective guarding with the Converse API (Converse
729
- # and ConverseStream).
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 base64 encode the image bytes.
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
@@ -1553,11 +1798,16 @@ module Aws::BedrockRuntime
1553
1798
  # @return [String]
1554
1799
  #
1555
1800
  # @!attribute [rw] guard_content
1556
- # A content block to assess with the guardrail. Use with the Converse
1557
- # API (Converse and ConverseStream).
1801
+ # A content block to assess with the guardrail. Use with the
1802
+ # [Converse][1] or [ConverseStream][2] API operations.
1558
1803
  #
1559
1804
  # For more information, see *Use a guardrail with the Converse API* in
1560
1805
  # the *Amazon Bedrock User Guide*.
1806
+ #
1807
+ #
1808
+ #
1809
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
1810
+ # [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
1561
1811
  # @return [Types::GuardrailConverseContentBlock]
1562
1812
  #
1563
1813
  # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/SystemContentBlock AWS API Documentation
@@ -1613,7 +1863,13 @@ module Aws::BedrockRuntime
1613
1863
  include Aws::Structure
1614
1864
  end
1615
1865
 
1616
- # Information about a tool that you can use with the Converse API.
1866
+ # Information about a tool that you can use with the Converse API. For
1867
+ # more information, see [Tool use (function calling)][1] in the Amazon
1868
+ # Bedrock User Guide.
1869
+ #
1870
+ #
1871
+ #
1872
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html
1617
1873
  #
1618
1874
  # @note Tool is a union - when making an API calls you must set exactly one of the members.
1619
1875
  #
@@ -1671,13 +1927,19 @@ module Aws::BedrockRuntime
1671
1927
  class Unknown < ToolChoice; end
1672
1928
  end
1673
1929
 
1674
- # Configuration information for the tools that you pass to a model.
1930
+ # Configuration information for the tools that you pass to a model. For
1931
+ # more information, see [Tool use (function calling)][1] in the Amazon
1932
+ # Bedrock User Guide.
1675
1933
  #
1676
1934
  # <note markdown="1"> This field is only supported by Anthropic Claude 3, Cohere Command R,
1677
1935
  # Cohere Command R+, and Mistral Large models.
1678
1936
  #
1679
1937
  # </note>
1680
1938
  #
1939
+ #
1940
+ #
1941
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html
1942
+ #
1681
1943
  # @!attribute [rw] tools
1682
1944
  # An array of tools that you want to pass to a model.
1683
1945
  # @return [Array<Types::Tool>]
@@ -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.converse(params)
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.15.0'
57
+ GEM_VERSION = '1.16.0'
58
58
 
59
59
  end
data/sig/client.rbs CHANGED
@@ -76,6 +76,29 @@ module Aws
76
76
  | (?Hash[Symbol, untyped]) -> instance
77
77
 
78
78
 
79
+ interface _ApplyGuardrailResponseSuccess
80
+ include ::Seahorse::Client::_ResponseSuccess[Types::ApplyGuardrailResponse]
81
+ def usage: () -> Types::GuardrailUsage
82
+ def action: () -> ("NONE" | "GUARDRAIL_INTERVENED")
83
+ def outputs: () -> ::Array[Types::GuardrailOutputContent]
84
+ def assessments: () -> ::Array[Types::GuardrailAssessment]
85
+ end
86
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/BedrockRuntime/Client.html#apply_guardrail-instance_method
87
+ def apply_guardrail: (
88
+ guardrail_identifier: ::String,
89
+ guardrail_version: ::String,
90
+ source: ("INPUT" | "OUTPUT"),
91
+ content: Array[
92
+ {
93
+ text: {
94
+ text: ::String,
95
+ qualifiers: Array[("grounding_source" | "query" | "guard_content")]?
96
+ }?
97
+ },
98
+ ]
99
+ ) -> _ApplyGuardrailResponseSuccess
100
+ | (Hash[Symbol, untyped] params, ?Hash[Symbol, untyped] options) -> _ApplyGuardrailResponseSuccess
101
+
79
102
  interface _ConverseResponseSuccess
80
103
  include ::Seahorse::Client::_ResponseSuccess[Types::ConverseResponse]
81
104
  def output: () -> Types::ConverseOutput
@@ -139,7 +162,8 @@ module Aws
139
162
  }?,
140
163
  guard_content: {
141
164
  text: {
142
- text: ::String
165
+ text: ::String,
166
+ qualifiers: Array[("grounding_source" | "query" | "guard_content")]?
143
167
  }?
144
168
  }?
145
169
  },
@@ -151,7 +175,8 @@ module Aws
151
175
  text: ::String?,
152
176
  guard_content: {
153
177
  text: {
154
- text: ::String
178
+ text: ::String,
179
+ qualifiers: Array[("grounding_source" | "query" | "guard_content")]?
155
180
  }?
156
181
  }?
157
182
  },
@@ -254,7 +279,8 @@ module Aws
254
279
  }?,
255
280
  guard_content: {
256
281
  text: {
257
- text: ::String
282
+ text: ::String,
283
+ qualifiers: Array[("grounding_source" | "query" | "guard_content")]?
258
284
  }?
259
285
  }?
260
286
  },
@@ -266,7 +292,8 @@ module Aws
266
292
  text: ::String?,
267
293
  guard_content: {
268
294
  text: {
269
- text: ::String
295
+ text: ::String,
296
+ qualifiers: Array[("grounding_source" | "query" | "guard_content")]?
270
297
  }?
271
298
  }?
272
299
  },
data/sig/types.rbs CHANGED
@@ -16,6 +16,22 @@ module Aws::BedrockRuntime
16
16
  class AnyToolChoice < Aws::EmptyStructure
17
17
  end
18
18
 
19
+ class ApplyGuardrailRequest
20
+ attr_accessor guardrail_identifier: ::String
21
+ attr_accessor guardrail_version: ::String
22
+ attr_accessor source: ("INPUT" | "OUTPUT")
23
+ attr_accessor content: ::Array[Types::GuardrailContentBlock]
24
+ SENSITIVE: []
25
+ end
26
+
27
+ class ApplyGuardrailResponse
28
+ attr_accessor usage: Types::GuardrailUsage
29
+ attr_accessor action: ("NONE" | "GUARDRAIL_INTERVENED")
30
+ attr_accessor outputs: ::Array[Types::GuardrailOutputContent]
31
+ attr_accessor assessments: ::Array[Types::GuardrailAssessment]
32
+ SENSITIVE: []
33
+ end
34
+
19
35
  class AutoToolChoice < Aws::EmptyStructure
20
36
  end
21
37
 
@@ -191,6 +207,7 @@ module Aws::BedrockRuntime
191
207
  attr_accessor content_policy: Types::GuardrailContentPolicyAssessment
192
208
  attr_accessor word_policy: Types::GuardrailWordPolicyAssessment
193
209
  attr_accessor sensitive_information_policy: Types::GuardrailSensitiveInformationPolicyAssessment
210
+ attr_accessor contextual_grounding_policy: Types::GuardrailContextualGroundingPolicyAssessment
194
211
  SENSITIVE: []
195
212
  end
196
213
 
@@ -201,6 +218,17 @@ module Aws::BedrockRuntime
201
218
  SENSITIVE: []
202
219
  end
203
220
 
221
+ class GuardrailContentBlock
222
+ attr_accessor text: Types::GuardrailTextBlock
223
+ attr_accessor unknown: untyped
224
+ SENSITIVE: []
225
+
226
+ class Text < GuardrailContentBlock
227
+ end
228
+ class Unknown < GuardrailContentBlock
229
+ end
230
+ end
231
+
204
232
  class GuardrailContentFilter
205
233
  attr_accessor type: ("INSULTS" | "HATE" | "SEXUAL" | "VIOLENCE" | "MISCONDUCT" | "PROMPT_ATTACK")
206
234
  attr_accessor confidence: ("NONE" | "LOW" | "MEDIUM" | "HIGH")
@@ -213,6 +241,19 @@ module Aws::BedrockRuntime
213
241
  SENSITIVE: []
214
242
  end
215
243
 
244
+ class GuardrailContextualGroundingFilter
245
+ attr_accessor type: ("GROUNDING" | "RELEVANCE")
246
+ attr_accessor threshold: ::Float
247
+ attr_accessor score: ::Float
248
+ attr_accessor action: ("BLOCKED" | "NONE")
249
+ SENSITIVE: []
250
+ end
251
+
252
+ class GuardrailContextualGroundingPolicyAssessment
253
+ attr_accessor filters: ::Array[Types::GuardrailContextualGroundingFilter]
254
+ SENSITIVE: []
255
+ end
256
+
216
257
  class GuardrailConverseContentBlock
217
258
  attr_accessor text: Types::GuardrailConverseTextBlock
218
259
  attr_accessor unknown: untyped
@@ -226,6 +267,7 @@ module Aws::BedrockRuntime
226
267
 
227
268
  class GuardrailConverseTextBlock
228
269
  attr_accessor text: ::String
270
+ attr_accessor qualifiers: ::Array[("grounding_source" | "query" | "guard_content")]
229
271
  SENSITIVE: []
230
272
  end
231
273
 
@@ -242,6 +284,11 @@ module Aws::BedrockRuntime
242
284
  SENSITIVE: []
243
285
  end
244
286
 
287
+ class GuardrailOutputContent
288
+ attr_accessor text: ::String
289
+ SENSITIVE: []
290
+ end
291
+
245
292
  class GuardrailPiiEntityFilter
246
293
  attr_accessor match: ::String
247
294
  attr_accessor type: ("ADDRESS" | "AGE" | "AWS_ACCESS_KEY" | "AWS_SECRET_KEY" | "CA_HEALTH_NUMBER" | "CA_SOCIAL_INSURANCE_NUMBER" | "CREDIT_DEBIT_CARD_CVV" | "CREDIT_DEBIT_CARD_EXPIRY" | "CREDIT_DEBIT_CARD_NUMBER" | "DRIVER_ID" | "EMAIL" | "INTERNATIONAL_BANK_ACCOUNT_NUMBER" | "IP_ADDRESS" | "LICENSE_PLATE" | "MAC_ADDRESS" | "NAME" | "PASSWORD" | "PHONE" | "PIN" | "SWIFT_CODE" | "UK_NATIONAL_HEALTH_SERVICE_NUMBER" | "UK_NATIONAL_INSURANCE_NUMBER" | "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER" | "URL" | "USERNAME" | "US_BANK_ACCOUNT_NUMBER" | "US_BANK_ROUTING_NUMBER" | "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER" | "US_PASSPORT_NUMBER" | "US_SOCIAL_SECURITY_NUMBER" | "VEHICLE_IDENTIFICATION_NUMBER")
@@ -271,6 +318,12 @@ module Aws::BedrockRuntime
271
318
  SENSITIVE: []
272
319
  end
273
320
 
321
+ class GuardrailTextBlock
322
+ attr_accessor text: ::String
323
+ attr_accessor qualifiers: ::Array[("grounding_source" | "query" | "guard_content")]
324
+ SENSITIVE: []
325
+ end
326
+
274
327
  class GuardrailTopic
275
328
  attr_accessor name: ::String
276
329
  attr_accessor type: ("DENY")
@@ -290,6 +343,16 @@ module Aws::BedrockRuntime
290
343
  SENSITIVE: []
291
344
  end
292
345
 
346
+ class GuardrailUsage
347
+ attr_accessor topic_policy_units: ::Integer
348
+ attr_accessor content_policy_units: ::Integer
349
+ attr_accessor word_policy_units: ::Integer
350
+ attr_accessor sensitive_information_policy_units: ::Integer
351
+ attr_accessor sensitive_information_policy_free_units: ::Integer
352
+ attr_accessor contextual_grounding_policy_units: ::Integer
353
+ SENSITIVE: []
354
+ end
355
+
293
356
  class GuardrailWordPolicyAssessment
294
357
  attr_accessor custom_words: ::Array[Types::GuardrailCustomWord]
295
358
  attr_accessor managed_word_lists: ::Array[Types::GuardrailManagedWord]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-bedrockruntime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.16.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: 2024-07-02 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core