aws-sdk-bedrockagentruntime 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cc803bf4f889db4885d44233100f88828fc7cfb99149a1a2ac536104e28e629
4
- data.tar.gz: 99eb1b4a9fbc673091079294ec6a5c69db1ea6c59ece19b623ed9f1dce14a0a2
3
+ metadata.gz: 24e10fc42b8ea0b4e35d44ca0c691949feaab6fe28ebe2a12c290ea005730c27
4
+ data.tar.gz: 7239ae58b7fc4a5343de154490f9c81eb7011fdd9a1be9472fc64575f6b4f803
5
5
  SHA512:
6
- metadata.gz: cd0d0b58178239d1ef2eed238b570d86a4a2b5f260cd5e3c21a2957f4299b1ef6bc92119691d1581c035765009d068396d2fed6a93838910f52bdda6c55b9017
7
- data.tar.gz: 8d9f09594ad68bcd0f79990e9ade1524719349ddde8c5e89370fa058e44f4bea7fe274aff63d3c646b034abb3089a0eda266444d522b5981d6025e5367f9f400
6
+ metadata.gz: 3f4d8ef61cdf0882cea1ab50df77212c91dda6f4a9457ad6632702c328f21fa20c1ff2dcff52544e935f747bb7b973c65f68ee40d77c63342c14f079599be7d7
7
+ data.tar.gz: 7b77085b8fe83e0f72e6276a82403b2a891515a51c3f2957860d516cb4b9657ea8be881250cda8abe01cd5417ef783b2ee499b8a84484bf72ca3f82f2e483ae6
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.5.0 (2024-03-27)
5
+ ------------------
6
+
7
+ * Feature - This release introduces filtering support on Retrieve and RetrieveAndGenerate APIs.
8
+
4
9
  1.4.0 (2024-03-26)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.5.0
@@ -686,6 +686,7 @@ module Aws::BedrockAgentRuntime
686
686
  # event.attribution.citations[0].retrieved_references[0].content.text #=> String
687
687
  # event.attribution.citations[0].retrieved_references[0].location.s3_location.uri #=> String
688
688
  # event.attribution.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
689
+ # event.attribution.citations[0].retrieved_references[0].metadata #=> Hash
689
690
  # event.bytes #=> String
690
691
  #
691
692
  # For :conflict_exception event available at #on_conflict_exception_event callback and response eventstream enumerator:
@@ -747,6 +748,7 @@ module Aws::BedrockAgentRuntime
747
748
  # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].content.text #=> String
748
749
  # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.s3_location.uri #=> String
749
750
  # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.type #=> String, one of "S3"
751
+ # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].metadata #=> Hash
750
752
  # event.trace.orchestration_trace.observation.reprompt_response.source #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "PARSER"
751
753
  # event.trace.orchestration_trace.observation.reprompt_response.text #=> String
752
754
  # event.trace.orchestration_trace.observation.trace_id #=> String
@@ -851,6 +853,63 @@ module Aws::BedrockAgentRuntime
851
853
  # next_token: "NextToken",
852
854
  # retrieval_configuration: {
853
855
  # vector_search_configuration: { # required
856
+ # filter: {
857
+ # and_all: [
858
+ # {
859
+ # # recursive RetrievalFilter
860
+ # },
861
+ # ],
862
+ # equals: {
863
+ # key: "FilterKey", # required
864
+ # value: { # required
865
+ # },
866
+ # },
867
+ # greater_than: {
868
+ # key: "FilterKey", # required
869
+ # value: { # required
870
+ # },
871
+ # },
872
+ # greater_than_or_equals: {
873
+ # key: "FilterKey", # required
874
+ # value: { # required
875
+ # },
876
+ # },
877
+ # in: {
878
+ # key: "FilterKey", # required
879
+ # value: { # required
880
+ # },
881
+ # },
882
+ # less_than: {
883
+ # key: "FilterKey", # required
884
+ # value: { # required
885
+ # },
886
+ # },
887
+ # less_than_or_equals: {
888
+ # key: "FilterKey", # required
889
+ # value: { # required
890
+ # },
891
+ # },
892
+ # not_equals: {
893
+ # key: "FilterKey", # required
894
+ # value: { # required
895
+ # },
896
+ # },
897
+ # not_in: {
898
+ # key: "FilterKey", # required
899
+ # value: { # required
900
+ # },
901
+ # },
902
+ # or_all: [
903
+ # {
904
+ # # recursive RetrievalFilter
905
+ # },
906
+ # ],
907
+ # starts_with: {
908
+ # key: "FilterKey", # required
909
+ # value: { # required
910
+ # },
911
+ # },
912
+ # },
854
913
  # number_of_results: 1,
855
914
  # override_search_type: "HYBRID", # accepts HYBRID, SEMANTIC
856
915
  # },
@@ -867,6 +926,7 @@ module Aws::BedrockAgentRuntime
867
926
  # resp.retrieval_results[0].content.text #=> String
868
927
  # resp.retrieval_results[0].location.s3_location.uri #=> String
869
928
  # resp.retrieval_results[0].location.type #=> String, one of "S3"
929
+ # resp.retrieval_results[0].metadata #=> Hash
870
930
  # resp.retrieval_results[0].score #=> Float
871
931
  #
872
932
  # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/Retrieve AWS API Documentation
@@ -879,8 +939,8 @@ module Aws::BedrockAgentRuntime
879
939
  end
880
940
 
881
941
  # Queries a knowledge base and generates responses based on the
882
- # retrieved results. The response cites up to five sources but only
883
- # selects the ones that are relevant to the query.
942
+ # retrieved results. The response only cites sources that are relevant
943
+ # to the query.
884
944
  #
885
945
  # @option params [required, Types::RetrieveAndGenerateInput] :input
886
946
  # Contains the query to be made to the knowledge base.
@@ -923,6 +983,63 @@ module Aws::BedrockAgentRuntime
923
983
  # model_arn: "BedrockModelArn", # required
924
984
  # retrieval_configuration: {
925
985
  # vector_search_configuration: { # required
986
+ # filter: {
987
+ # and_all: [
988
+ # {
989
+ # # recursive RetrievalFilter
990
+ # },
991
+ # ],
992
+ # equals: {
993
+ # key: "FilterKey", # required
994
+ # value: { # required
995
+ # },
996
+ # },
997
+ # greater_than: {
998
+ # key: "FilterKey", # required
999
+ # value: { # required
1000
+ # },
1001
+ # },
1002
+ # greater_than_or_equals: {
1003
+ # key: "FilterKey", # required
1004
+ # value: { # required
1005
+ # },
1006
+ # },
1007
+ # in: {
1008
+ # key: "FilterKey", # required
1009
+ # value: { # required
1010
+ # },
1011
+ # },
1012
+ # less_than: {
1013
+ # key: "FilterKey", # required
1014
+ # value: { # required
1015
+ # },
1016
+ # },
1017
+ # less_than_or_equals: {
1018
+ # key: "FilterKey", # required
1019
+ # value: { # required
1020
+ # },
1021
+ # },
1022
+ # not_equals: {
1023
+ # key: "FilterKey", # required
1024
+ # value: { # required
1025
+ # },
1026
+ # },
1027
+ # not_in: {
1028
+ # key: "FilterKey", # required
1029
+ # value: { # required
1030
+ # },
1031
+ # },
1032
+ # or_all: [
1033
+ # {
1034
+ # # recursive RetrievalFilter
1035
+ # },
1036
+ # ],
1037
+ # starts_with: {
1038
+ # key: "FilterKey", # required
1039
+ # value: { # required
1040
+ # },
1041
+ # },
1042
+ # },
926
1043
  # number_of_results: 1,
927
1044
  # override_search_type: "HYBRID", # accepts HYBRID, SEMANTIC
928
1045
  # },
@@ -946,6 +1063,7 @@ module Aws::BedrockAgentRuntime
946
1063
  # resp.citations[0].retrieved_references[0].content.text #=> String
947
1064
  # resp.citations[0].retrieved_references[0].location.s3_location.uri #=> String
948
1065
  # resp.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
1066
+ # resp.citations[0].retrieved_references[0].metadata #=> Hash
949
1067
  # resp.output.text #=> String
950
1068
  # resp.session_id #=> String
951
1069
  #
@@ -971,7 +1089,7 @@ module Aws::BedrockAgentRuntime
971
1089
  params: params,
972
1090
  config: config)
973
1091
  context[:gem_name] = 'aws-sdk-bedrockagentruntime'
974
- context[:gem_version] = '1.4.0'
1092
+ context[:gem_version] = '1.5.0'
975
1093
  Seahorse::Client::Request.new(handlers, context)
976
1094
  end
977
1095
 
@@ -34,6 +34,9 @@ module Aws::BedrockAgentRuntime
34
34
  Double = Shapes::FloatShape.new(name: 'Double')
35
35
  FailureReasonString = Shapes::StringShape.new(name: 'FailureReasonString')
36
36
  FailureTrace = Shapes::StructureShape.new(name: 'FailureTrace')
37
+ FilterAttribute = Shapes::StructureShape.new(name: 'FilterAttribute')
38
+ FilterKey = Shapes::StringShape.new(name: 'FilterKey')
39
+ FilterValue = Shapes::DocumentShape.new(name: 'FilterValue', document: true)
37
40
  FinalResponse = Shapes::StructureShape.new(name: 'FinalResponse')
38
41
  FinalResponseString = Shapes::StringShape.new(name: 'FinalResponseString')
39
42
  GeneratedResponsePart = Shapes::StructureShape.new(name: 'GeneratedResponsePart')
@@ -87,9 +90,14 @@ module Aws::BedrockAgentRuntime
87
90
  RequestBody = Shapes::StructureShape.new(name: 'RequestBody')
88
91
  ResourceNotFoundException = Shapes::StructureShape.new(name: 'ResourceNotFoundException')
89
92
  ResponseStream = Shapes::StructureShape.new(name: 'ResponseStream')
93
+ RetrievalFilter = Shapes::UnionShape.new(name: 'RetrievalFilter')
94
+ RetrievalFilterList = Shapes::ListShape.new(name: 'RetrievalFilterList')
90
95
  RetrievalResultContent = Shapes::StructureShape.new(name: 'RetrievalResultContent')
91
96
  RetrievalResultLocation = Shapes::StructureShape.new(name: 'RetrievalResultLocation')
92
97
  RetrievalResultLocationType = Shapes::StringShape.new(name: 'RetrievalResultLocationType')
98
+ RetrievalResultMetadata = Shapes::MapShape.new(name: 'RetrievalResultMetadata')
99
+ RetrievalResultMetadataKey = Shapes::StringShape.new(name: 'RetrievalResultMetadataKey')
100
+ RetrievalResultMetadataValue = Shapes::DocumentShape.new(name: 'RetrievalResultMetadataValue', document: true)
93
101
  RetrievalResultS3Location = Shapes::StructureShape.new(name: 'RetrievalResultS3Location')
94
102
  RetrieveAndGenerateConfiguration = Shapes::StructureShape.new(name: 'RetrieveAndGenerateConfiguration')
95
103
  RetrieveAndGenerateInput = Shapes::StructureShape.new(name: 'RetrieveAndGenerateInput')
@@ -168,6 +176,10 @@ module Aws::BedrockAgentRuntime
168
176
  FailureTrace.add_member(:trace_id, Shapes::ShapeRef.new(shape: TraceId, location_name: "traceId"))
169
177
  FailureTrace.struct_class = Types::FailureTrace
170
178
 
179
+ FilterAttribute.add_member(:key, Shapes::ShapeRef.new(shape: FilterKey, required: true, location_name: "key"))
180
+ FilterAttribute.add_member(:value, Shapes::ShapeRef.new(shape: FilterValue, required: true, location_name: "value"))
181
+ FilterAttribute.struct_class = Types::FilterAttribute
182
+
171
183
  FinalResponse.add_member(:text, Shapes::ShapeRef.new(shape: FinalResponseString, location_name: "text"))
172
184
  FinalResponse.struct_class = Types::FinalResponse
173
185
 
@@ -224,6 +236,7 @@ module Aws::BedrockAgentRuntime
224
236
 
225
237
  KnowledgeBaseRetrievalResult.add_member(:content, Shapes::ShapeRef.new(shape: RetrievalResultContent, required: true, location_name: "content"))
226
238
  KnowledgeBaseRetrievalResult.add_member(:location, Shapes::ShapeRef.new(shape: RetrievalResultLocation, location_name: "location"))
239
+ KnowledgeBaseRetrievalResult.add_member(:metadata, Shapes::ShapeRef.new(shape: RetrievalResultMetadata, location_name: "metadata"))
227
240
  KnowledgeBaseRetrievalResult.add_member(:score, Shapes::ShapeRef.new(shape: Double, location_name: "score"))
228
241
  KnowledgeBaseRetrievalResult.struct_class = Types::KnowledgeBaseRetrievalResult
229
242
 
@@ -235,6 +248,7 @@ module Aws::BedrockAgentRuntime
235
248
  KnowledgeBaseRetrieveAndGenerateConfiguration.add_member(:retrieval_configuration, Shapes::ShapeRef.new(shape: KnowledgeBaseRetrievalConfiguration, location_name: "retrievalConfiguration"))
236
249
  KnowledgeBaseRetrieveAndGenerateConfiguration.struct_class = Types::KnowledgeBaseRetrieveAndGenerateConfiguration
237
250
 
251
+ KnowledgeBaseVectorSearchConfiguration.add_member(:filter, Shapes::ShapeRef.new(shape: RetrievalFilter, location_name: "filter"))
238
252
  KnowledgeBaseVectorSearchConfiguration.add_member(:number_of_results, Shapes::ShapeRef.new(shape: KnowledgeBaseVectorSearchConfigurationNumberOfResultsInteger, location_name: "numberOfResults", metadata: {"box"=>true}))
239
253
  KnowledgeBaseVectorSearchConfiguration.add_member(:override_search_type, Shapes::ShapeRef.new(shape: SearchType, location_name: "overrideSearchType"))
240
254
  KnowledgeBaseVectorSearchConfiguration.struct_class = Types::KnowledgeBaseVectorSearchConfiguration
@@ -343,6 +357,34 @@ module Aws::BedrockAgentRuntime
343
357
  ResponseStream.add_member(:validation_exception, Shapes::ShapeRef.new(shape: ValidationException, location_name: "validationException"))
344
358
  ResponseStream.struct_class = Types::ResponseStream
345
359
 
360
+ RetrievalFilter.add_member(:and_all, Shapes::ShapeRef.new(shape: RetrievalFilterList, location_name: "andAll"))
361
+ RetrievalFilter.add_member(:equals, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "equals"))
362
+ RetrievalFilter.add_member(:greater_than, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "greaterThan"))
363
+ RetrievalFilter.add_member(:greater_than_or_equals, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "greaterThanOrEquals"))
364
+ RetrievalFilter.add_member(:in, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "in"))
365
+ RetrievalFilter.add_member(:less_than, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "lessThan"))
366
+ RetrievalFilter.add_member(:less_than_or_equals, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "lessThanOrEquals"))
367
+ RetrievalFilter.add_member(:not_equals, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "notEquals"))
368
+ RetrievalFilter.add_member(:not_in, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "notIn"))
369
+ RetrievalFilter.add_member(:or_all, Shapes::ShapeRef.new(shape: RetrievalFilterList, location_name: "orAll"))
370
+ RetrievalFilter.add_member(:starts_with, Shapes::ShapeRef.new(shape: FilterAttribute, location_name: "startsWith"))
371
+ RetrievalFilter.add_member(:unknown, Shapes::ShapeRef.new(shape: nil, location_name: 'unknown'))
372
+ RetrievalFilter.add_member_subclass(:and_all, Types::RetrievalFilter::AndAll)
373
+ RetrievalFilter.add_member_subclass(:equals, Types::RetrievalFilter::Equals)
374
+ RetrievalFilter.add_member_subclass(:greater_than, Types::RetrievalFilter::GreaterThan)
375
+ RetrievalFilter.add_member_subclass(:greater_than_or_equals, Types::RetrievalFilter::GreaterThanOrEquals)
376
+ RetrievalFilter.add_member_subclass(:in, Types::RetrievalFilter::In)
377
+ RetrievalFilter.add_member_subclass(:less_than, Types::RetrievalFilter::LessThan)
378
+ RetrievalFilter.add_member_subclass(:less_than_or_equals, Types::RetrievalFilter::LessThanOrEquals)
379
+ RetrievalFilter.add_member_subclass(:not_equals, Types::RetrievalFilter::NotEquals)
380
+ RetrievalFilter.add_member_subclass(:not_in, Types::RetrievalFilter::NotIn)
381
+ RetrievalFilter.add_member_subclass(:or_all, Types::RetrievalFilter::OrAll)
382
+ RetrievalFilter.add_member_subclass(:starts_with, Types::RetrievalFilter::StartsWith)
383
+ RetrievalFilter.add_member_subclass(:unknown, Types::RetrievalFilter::Unknown)
384
+ RetrievalFilter.struct_class = Types::RetrievalFilter
385
+
386
+ RetrievalFilterList.member = Shapes::ShapeRef.new(shape: RetrievalFilter)
387
+
346
388
  RetrievalResultContent.add_member(:text, Shapes::ShapeRef.new(shape: String, required: true, location_name: "text"))
347
389
  RetrievalResultContent.struct_class = Types::RetrievalResultContent
348
390
 
@@ -350,6 +392,9 @@ module Aws::BedrockAgentRuntime
350
392
  RetrievalResultLocation.add_member(:type, Shapes::ShapeRef.new(shape: RetrievalResultLocationType, required: true, location_name: "type"))
351
393
  RetrievalResultLocation.struct_class = Types::RetrievalResultLocation
352
394
 
395
+ RetrievalResultMetadata.key = Shapes::ShapeRef.new(shape: RetrievalResultMetadataKey)
396
+ RetrievalResultMetadata.value = Shapes::ShapeRef.new(shape: RetrievalResultMetadataValue)
397
+
353
398
  RetrievalResultS3Location.add_member(:uri, Shapes::ShapeRef.new(shape: String, location_name: "uri"))
354
399
  RetrievalResultS3Location.struct_class = Types::RetrievalResultS3Location
355
400
 
@@ -389,6 +434,7 @@ module Aws::BedrockAgentRuntime
389
434
 
390
435
  RetrievedReference.add_member(:content, Shapes::ShapeRef.new(shape: RetrievalResultContent, location_name: "content"))
391
436
  RetrievedReference.add_member(:location, Shapes::ShapeRef.new(shape: RetrievalResultLocation, location_name: "location"))
437
+ RetrievedReference.add_member(:metadata, Shapes::ShapeRef.new(shape: RetrievalResultMetadata, location_name: "metadata"))
392
438
  RetrievedReference.struct_class = Types::RetrievedReference
393
439
 
394
440
  RetrievedReferences.member = Shapes::ShapeRef.new(shape: RetrievedReference)
@@ -199,6 +199,38 @@ module Aws::BedrockAgentRuntime
199
199
  include Aws::Structure
200
200
  end
201
201
 
202
+ # Specifies the name that the metadata attribute must match and the
203
+ # value to which to compare the value of the metadata attribute. For
204
+ # more information, see [Query configurations][1].
205
+ #
206
+ # This data type is used in the following API operations:
207
+ #
208
+ # * [RetrieveAndGenerate request][2]
209
+ #
210
+ # ^
211
+ #
212
+ #
213
+ #
214
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html
215
+ # [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax
216
+ #
217
+ # @!attribute [rw] key
218
+ # The name that the metadata attribute must match.
219
+ # @return [String]
220
+ #
221
+ # @!attribute [rw] value
222
+ # The value to whcih to compare the value of the metadata attribute.
223
+ # @return [Hash,Array,String,Numeric,Boolean]
224
+ #
225
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/FilterAttribute AWS API Documentation
226
+ #
227
+ class FilterAttribute < Struct.new(
228
+ :key,
229
+ :value)
230
+ SENSITIVE = []
231
+ include Aws::Structure
232
+ end
233
+
202
234
  # Contains details about the response to the user.
203
235
  #
204
236
  # @!attribute [rw] text
@@ -558,6 +590,15 @@ module Aws::BedrockAgentRuntime
558
590
  # Contains information about the location of the data source.
559
591
  # @return [Types::RetrievalResultLocation]
560
592
  #
593
+ # @!attribute [rw] metadata
594
+ # Contains metadata attributes and their values for the file in the
595
+ # data source. For more information, see [Metadata and filtering][1].
596
+ #
597
+ #
598
+ #
599
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds.html#kb-ds-metadata
600
+ # @return [Hash<String,Hash,Array,String,Numeric,Boolean>]
601
+ #
561
602
  # @!attribute [rw] score
562
603
  # The level of relevance of the result to the query.
563
604
  # @return [Float]
@@ -567,8 +608,9 @@ module Aws::BedrockAgentRuntime
567
608
  class KnowledgeBaseRetrievalResult < Struct.new(
568
609
  :content,
569
610
  :location,
611
+ :metadata,
570
612
  :score)
571
- SENSITIVE = [:content, :location]
613
+ SENSITIVE = [:content, :location, :metadata]
572
614
  include Aws::Structure
573
615
  end
574
616
 
@@ -632,6 +674,16 @@ module Aws::BedrockAgentRuntime
632
674
  # [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax
633
675
  # [3]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax
634
676
  #
677
+ # @!attribute [rw] filter
678
+ # Specifies the filters to use on the metadata in the knowledge base
679
+ # data sources before returning results. For more information, see
680
+ # [Query configurations][1].
681
+ #
682
+ #
683
+ #
684
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html
685
+ # @return [Types::RetrievalFilter]
686
+ #
635
687
  # @!attribute [rw] number_of_results
636
688
  # The number of source chunks to retrieve.
637
689
  # @return [Integer]
@@ -654,9 +706,10 @@ module Aws::BedrockAgentRuntime
654
706
  # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/KnowledgeBaseVectorSearchConfiguration AWS API Documentation
655
707
  #
656
708
  class KnowledgeBaseVectorSearchConfiguration < Struct.new(
709
+ :filter,
657
710
  :number_of_results,
658
711
  :override_search_type)
659
- SENSITIVE = []
712
+ SENSITIVE = [:filter]
660
713
  include Aws::Structure
661
714
  end
662
715
 
@@ -1056,7 +1109,7 @@ module Aws::BedrockAgentRuntime
1056
1109
  #
1057
1110
  # This data type is used in the following API operations:
1058
1111
  #
1059
- # * [RetrieveAndGenerate request][2]
1112
+ # * [RetrieveAndGenerate request][2] – in the `filter` field
1060
1113
  #
1061
1114
  # ^
1062
1115
  #
@@ -1161,6 +1214,122 @@ module Aws::BedrockAgentRuntime
1161
1214
  include Aws::Structure
1162
1215
  end
1163
1216
 
1217
+ # Specifies the filters to use on the metadata attributes in the
1218
+ # knowledge base data sources before returning results. For more
1219
+ # information, see [Query configurations][1].
1220
+ #
1221
+ # This data type is used in the following API operations:
1222
+ #
1223
+ # * [Retrieve request][2] – in the `filter` field
1224
+ #
1225
+ # * [RetrieveAndGenerate request][3] – in the `filter` field
1226
+ #
1227
+ #
1228
+ #
1229
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html
1230
+ # [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax
1231
+ # [3]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax
1232
+ #
1233
+ # @note RetrievalFilter is a union - when making an API calls you must set exactly one of the members.
1234
+ #
1235
+ # @!attribute [rw] and_all
1236
+ # Knowledge base data sources whose metadata attributes fulfill all
1237
+ # the filter conditions inside this list are returned.
1238
+ # @return [Array<Types::RetrievalFilter>]
1239
+ #
1240
+ # @!attribute [rw] equals
1241
+ # Knowledge base data sources that contain a metadata attribute whose
1242
+ # name matches the `key` and whose value matches the `value` in this
1243
+ # object are returned.
1244
+ # @return [Types::FilterAttribute]
1245
+ #
1246
+ # @!attribute [rw] greater_than
1247
+ # Knowledge base data sources that contain a metadata attribute whose
1248
+ # name matches the `key` and whose value is greater than the `value`
1249
+ # in this object are returned.
1250
+ # @return [Types::FilterAttribute]
1251
+ #
1252
+ # @!attribute [rw] greater_than_or_equals
1253
+ # Knowledge base data sources that contain a metadata attribute whose
1254
+ # name matches the `key` and whose value is greater than or equal to
1255
+ # the `value` in this object are returned.
1256
+ # @return [Types::FilterAttribute]
1257
+ #
1258
+ # @!attribute [rw] in
1259
+ # Knowledge base data sources that contain a metadata attribute whose
1260
+ # name matches the `key` and whose value is in the list specified in
1261
+ # the `value` in this object are returned.
1262
+ # @return [Types::FilterAttribute]
1263
+ #
1264
+ # @!attribute [rw] less_than
1265
+ # Knowledge base data sources that contain a metadata attribute whose
1266
+ # name matches the `key` and whose value is less than the `value` in
1267
+ # this object are returned.
1268
+ # @return [Types::FilterAttribute]
1269
+ #
1270
+ # @!attribute [rw] less_than_or_equals
1271
+ # Knowledge base data sources that contain a metadata attribute whose
1272
+ # name matches the `key` and whose value is less than or equal to the
1273
+ # `value` in this object are returned.
1274
+ # @return [Types::FilterAttribute]
1275
+ #
1276
+ # @!attribute [rw] not_equals
1277
+ # Knowledge base data sources that contain a metadata attribute whose
1278
+ # name matches the `key` and whose value doesn't match the `value` in
1279
+ # this object are returned.
1280
+ # @return [Types::FilterAttribute]
1281
+ #
1282
+ # @!attribute [rw] not_in
1283
+ # Knowledge base data sources that contain a metadata attribute whose
1284
+ # name matches the `key` and whose value isn't in the list specified
1285
+ # in the `value` in this object are returned.
1286
+ # @return [Types::FilterAttribute]
1287
+ #
1288
+ # @!attribute [rw] or_all
1289
+ # Knowledge base data sources whose metadata attributes fulfill at
1290
+ # least one of the filter conditions inside this list are returned.
1291
+ # @return [Array<Types::RetrievalFilter>]
1292
+ #
1293
+ # @!attribute [rw] starts_with
1294
+ # Knowledge base data sources that contain a metadata attribute whose
1295
+ # name matches the `key` and whose value starts with the `value` in
1296
+ # this object are returned. This filter is currently only supported
1297
+ # for Amazon OpenSearch Serverless vector stores.
1298
+ # @return [Types::FilterAttribute]
1299
+ #
1300
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/RetrievalFilter AWS API Documentation
1301
+ #
1302
+ class RetrievalFilter < Struct.new(
1303
+ :and_all,
1304
+ :equals,
1305
+ :greater_than,
1306
+ :greater_than_or_equals,
1307
+ :in,
1308
+ :less_than,
1309
+ :less_than_or_equals,
1310
+ :not_equals,
1311
+ :not_in,
1312
+ :or_all,
1313
+ :starts_with,
1314
+ :unknown)
1315
+ SENSITIVE = []
1316
+ include Aws::Structure
1317
+ include Aws::Structure::Union
1318
+
1319
+ class AndAll < RetrievalFilter; end
1320
+ class Equals < RetrievalFilter; end
1321
+ class GreaterThan < RetrievalFilter; end
1322
+ class GreaterThanOrEquals < RetrievalFilter; end
1323
+ class In < RetrievalFilter; end
1324
+ class LessThan < RetrievalFilter; end
1325
+ class LessThanOrEquals < RetrievalFilter; end
1326
+ class NotEquals < RetrievalFilter; end
1327
+ class NotIn < RetrievalFilter; end
1328
+ class OrAll < RetrievalFilter; end
1329
+ class StartsWith < RetrievalFilter; end
1330
+ class Unknown < RetrievalFilter; end
1331
+ end
1332
+
1164
1333
  # Contains the cited text from the data source.
1165
1334
  #
1166
1335
  # This data type is used in the following API operations:
@@ -1483,12 +1652,22 @@ module Aws::BedrockAgentRuntime
1483
1652
  # Contains information about the location of the data source.
1484
1653
  # @return [Types::RetrievalResultLocation]
1485
1654
  #
1655
+ # @!attribute [rw] metadata
1656
+ # Contains metadata attributes and their values for the file in the
1657
+ # data source. For more information, see [Metadata and filtering][1].
1658
+ #
1659
+ #
1660
+ #
1661
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds.html#kb-ds-metadata
1662
+ # @return [Hash<String,Hash,Array,String,Numeric,Boolean>]
1663
+ #
1486
1664
  # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/RetrievedReference AWS API Documentation
1487
1665
  #
1488
1666
  class RetrievedReference < Struct.new(
1489
1667
  :content,
1490
- :location)
1491
- SENSITIVE = [:content, :location]
1668
+ :location,
1669
+ :metadata)
1670
+ SENSITIVE = [:content, :location, :metadata]
1492
1671
  include Aws::Structure
1493
1672
  end
1494
1673
 
@@ -53,6 +53,6 @@ require_relative 'aws-sdk-bedrockagentruntime/event_streams'
53
53
  # @!group service
54
54
  module Aws::BedrockAgentRuntime
55
55
 
56
- GEM_VERSION = '1.4.0'
56
+ GEM_VERSION = '1.5.0'
57
57
 
58
58
  end
data/sig/client.rbs CHANGED
@@ -107,6 +107,59 @@ module Aws
107
107
  ?next_token: ::String,
108
108
  ?retrieval_configuration: {
109
109
  vector_search_configuration: {
110
+ filter: {
111
+ and_all: Array[
112
+ untyped,
113
+ ]?,
114
+ equals: {
115
+ key: ::String,
116
+ value: {
117
+ }
118
+ }?,
119
+ greater_than: {
120
+ key: ::String,
121
+ value: {
122
+ }
123
+ }?,
124
+ greater_than_or_equals: {
125
+ key: ::String,
126
+ value: {
127
+ }
128
+ }?,
129
+ in: {
130
+ key: ::String,
131
+ value: {
132
+ }
133
+ }?,
134
+ less_than: {
135
+ key: ::String,
136
+ value: {
137
+ }
138
+ }?,
139
+ less_than_or_equals: {
140
+ key: ::String,
141
+ value: {
142
+ }
143
+ }?,
144
+ not_equals: {
145
+ key: ::String,
146
+ value: {
147
+ }
148
+ }?,
149
+ not_in: {
150
+ key: ::String,
151
+ value: {
152
+ }
153
+ }?,
154
+ or_all: Array[
155
+ untyped,
156
+ ]?,
157
+ starts_with: {
158
+ key: ::String,
159
+ value: {
160
+ }
161
+ }?
162
+ }?,
110
163
  number_of_results: ::Integer?,
111
164
  override_search_type: ("HYBRID" | "SEMANTIC")?
112
165
  }
@@ -139,6 +192,59 @@ module Aws
139
192
  model_arn: ::String,
140
193
  retrieval_configuration: {
141
194
  vector_search_configuration: {
195
+ filter: {
196
+ and_all: Array[
197
+ untyped,
198
+ ]?,
199
+ equals: {
200
+ key: ::String,
201
+ value: {
202
+ }
203
+ }?,
204
+ greater_than: {
205
+ key: ::String,
206
+ value: {
207
+ }
208
+ }?,
209
+ greater_than_or_equals: {
210
+ key: ::String,
211
+ value: {
212
+ }
213
+ }?,
214
+ in: {
215
+ key: ::String,
216
+ value: {
217
+ }
218
+ }?,
219
+ less_than: {
220
+ key: ::String,
221
+ value: {
222
+ }
223
+ }?,
224
+ less_than_or_equals: {
225
+ key: ::String,
226
+ value: {
227
+ }
228
+ }?,
229
+ not_equals: {
230
+ key: ::String,
231
+ value: {
232
+ }
233
+ }?,
234
+ not_in: {
235
+ key: ::String,
236
+ value: {
237
+ }
238
+ }?,
239
+ or_all: Array[
240
+ untyped,
241
+ ]?,
242
+ starts_with: {
243
+ key: ::String,
244
+ value: {
245
+ }
246
+ }?
247
+ }?,
142
248
  number_of_results: ::Integer?,
143
249
  override_search_type: ("HYBRID" | "SEMANTIC")?
144
250
  }
data/sig/types.rbs CHANGED
@@ -65,6 +65,12 @@ module Aws::BedrockAgentRuntime
65
65
  SENSITIVE: [:failure_reason]
66
66
  end
67
67
 
68
+ class FilterAttribute
69
+ attr_accessor key: ::String
70
+ attr_accessor value: untyped
71
+ SENSITIVE: []
72
+ end
73
+
68
74
  class FinalResponse
69
75
  attr_accessor text: ::String
70
76
  SENSITIVE: [:text]
@@ -145,8 +151,9 @@ module Aws::BedrockAgentRuntime
145
151
  class KnowledgeBaseRetrievalResult
146
152
  attr_accessor content: Types::RetrievalResultContent
147
153
  attr_accessor location: Types::RetrievalResultLocation
154
+ attr_accessor metadata: ::Hash[::String, untyped]
148
155
  attr_accessor score: ::Float
149
- SENSITIVE: [:content, :location]
156
+ SENSITIVE: [:content, :location, :metadata]
150
157
  end
151
158
 
152
159
  class KnowledgeBaseRetrieveAndGenerateConfiguration
@@ -158,9 +165,10 @@ module Aws::BedrockAgentRuntime
158
165
  end
159
166
 
160
167
  class KnowledgeBaseVectorSearchConfiguration
168
+ attr_accessor filter: Types::RetrievalFilter
161
169
  attr_accessor number_of_results: ::Integer
162
170
  attr_accessor override_search_type: ("HYBRID" | "SEMANTIC")
163
- SENSITIVE: []
171
+ SENSITIVE: [:filter]
164
172
  end
165
173
 
166
174
  class ModelInvocationInput
@@ -297,6 +305,47 @@ module Aws::BedrockAgentRuntime
297
305
  SENSITIVE: []
298
306
  end
299
307
 
308
+ class RetrievalFilter
309
+ attr_accessor and_all: ::Array[Types::RetrievalFilter]
310
+ attr_accessor equals: Types::FilterAttribute
311
+ attr_accessor greater_than: Types::FilterAttribute
312
+ attr_accessor greater_than_or_equals: Types::FilterAttribute
313
+ attr_accessor in: Types::FilterAttribute
314
+ attr_accessor less_than: Types::FilterAttribute
315
+ attr_accessor less_than_or_equals: Types::FilterAttribute
316
+ attr_accessor not_equals: Types::FilterAttribute
317
+ attr_accessor not_in: Types::FilterAttribute
318
+ attr_accessor or_all: ::Array[Types::RetrievalFilter]
319
+ attr_accessor starts_with: Types::FilterAttribute
320
+ attr_accessor unknown: untyped
321
+ SENSITIVE: []
322
+
323
+ class AndAll < RetrievalFilter
324
+ end
325
+ class Equals < RetrievalFilter
326
+ end
327
+ class GreaterThan < RetrievalFilter
328
+ end
329
+ class GreaterThanOrEquals < RetrievalFilter
330
+ end
331
+ class In < RetrievalFilter
332
+ end
333
+ class LessThan < RetrievalFilter
334
+ end
335
+ class LessThanOrEquals < RetrievalFilter
336
+ end
337
+ class NotEquals < RetrievalFilter
338
+ end
339
+ class NotIn < RetrievalFilter
340
+ end
341
+ class OrAll < RetrievalFilter
342
+ end
343
+ class StartsWith < RetrievalFilter
344
+ end
345
+ class Unknown < RetrievalFilter
346
+ end
347
+ end
348
+
300
349
  class RetrievalResultContent
301
350
  attr_accessor text: ::String
302
351
  SENSITIVE: []
@@ -366,7 +415,8 @@ module Aws::BedrockAgentRuntime
366
415
  class RetrievedReference
367
416
  attr_accessor content: Types::RetrievalResultContent
368
417
  attr_accessor location: Types::RetrievalResultLocation
369
- SENSITIVE: [:content, :location]
418
+ attr_accessor metadata: ::Hash[::String, untyped]
419
+ SENSITIVE: [:content, :location, :metadata]
370
420
  end
371
421
 
372
422
  class ServiceQuotaExceededException
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-bedrockagentruntime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.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-03-26 00:00:00.000000000 Z
11
+ date: 2024-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core