Skip to content

Commit 3897290

Browse files
Add support for API Keys, Re-Ranker, implicit filter for RAG / KB evaluation for Bedrock APIs.
1 parent 80c3760 commit 3897290

File tree

32 files changed

+2841
-4
lines changed

32 files changed

+2841
-4
lines changed

generator/ServiceModels/bedrock/bedrock-2023-04-20.api.json

Lines changed: 142 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
"version":"2.0",
33
"metadata":{
44
"apiVersion":"2023-04-20",
5-
"auth":["aws.auth#sigv4"],
5+
"auth":[
6+
"aws.auth#sigv4",
7+
"smithy.api#httpBearerAuth"
8+
],
69
"endpointPrefix":"bedrock",
710
"protocol":"rest-json",
811
"protocols":["rest-json"],
@@ -1251,6 +1254,15 @@
12511254
"max":2048,
12521255
"min":0
12531256
},
1257+
"AttributeType":{
1258+
"type":"string",
1259+
"enum":[
1260+
"STRING",
1261+
"NUMBER",
1262+
"BOOLEAN",
1263+
"STRING_LIST"
1264+
]
1265+
},
12541266
"AuthorizationStatus":{
12551267
"type":"string",
12561268
"enum":[
@@ -1373,6 +1385,12 @@
13731385
"min":0,
13741386
"pattern":"[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([a-z0-9-]{1,63}[.]){0,2}[a-z0-9-]{1,63}([:][a-z0-9-]{1,63}){0,2}(/[a-z0-9]{12}|)"
13751387
},
1388+
"BedrockRerankingModelArn":{
1389+
"type":"string",
1390+
"max":2048,
1391+
"min":1,
1392+
"pattern":"(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}::foundation-model/(.*))?"
1393+
},
13761394
"Boolean":{
13771395
"type":"boolean",
13781396
"box":true
@@ -2501,6 +2519,25 @@
25012519
"generationConfiguration":{"shape":"ExternalSourcesGenerationConfiguration"}
25022520
}
25032521
},
2522+
"FieldForReranking":{
2523+
"type":"structure",
2524+
"required":["fieldName"],
2525+
"members":{
2526+
"fieldName":{"shape":"FieldForRerankingFieldNameString"}
2527+
}
2528+
},
2529+
"FieldForRerankingFieldNameString":{
2530+
"type":"string",
2531+
"max":2000,
2532+
"min":1
2533+
},
2534+
"FieldsForReranking":{
2535+
"type":"list",
2536+
"member":{"shape":"FieldForReranking"},
2537+
"max":100,
2538+
"min":1,
2539+
"sensitive":true
2540+
},
25042541
"FilterAttribute":{
25052542
"type":"structure",
25062543
"required":[
@@ -3933,6 +3970,17 @@
39333970
"min":1,
39343971
"sensitive":true
39353972
},
3973+
"ImplicitFilterConfiguration":{
3974+
"type":"structure",
3975+
"required":[
3976+
"metadataAttributes",
3977+
"modelArn"
3978+
],
3979+
"members":{
3980+
"metadataAttributes":{"shape":"MetadataAttributeSchemaList"},
3981+
"modelArn":{"shape":"BedrockModelArn"}
3982+
}
3983+
},
39363984
"ImportedModelArn":{
39373985
"type":"string",
39383986
"max":1011,
@@ -4197,7 +4245,9 @@
41974245
"members":{
41984246
"numberOfResults":{"shape":"KnowledgeBaseVectorSearchConfigurationNumberOfResultsInteger"},
41994247
"overrideSearchType":{"shape":"SearchType"},
4200-
"filter":{"shape":"RetrievalFilter"}
4248+
"filter":{"shape":"RetrievalFilter"},
4249+
"implicitFilterConfiguration":{"shape":"ImplicitFilterConfiguration"},
4250+
"rerankingConfiguration":{"shape":"VectorSearchRerankingConfiguration"}
42014251
}
42024252
},
42034253
"KnowledgeBaseVectorSearchConfigurationNumberOfResultsInteger":{
@@ -4917,6 +4967,46 @@
49174967
"min":0,
49184968
"sensitive":true
49194969
},
4970+
"MetadataAttributeSchema":{
4971+
"type":"structure",
4972+
"required":[
4973+
"key",
4974+
"type",
4975+
"description"
4976+
],
4977+
"members":{
4978+
"key":{"shape":"MetadataAttributeSchemaKeyString"},
4979+
"type":{"shape":"AttributeType"},
4980+
"description":{"shape":"MetadataAttributeSchemaDescriptionString"}
4981+
},
4982+
"sensitive":true
4983+
},
4984+
"MetadataAttributeSchemaDescriptionString":{
4985+
"type":"string",
4986+
"max":1024,
4987+
"min":1,
4988+
"pattern":"[\\s\\S]+"
4989+
},
4990+
"MetadataAttributeSchemaKeyString":{
4991+
"type":"string",
4992+
"max":256,
4993+
"min":1,
4994+
"pattern":"[\\s\\S]+"
4995+
},
4996+
"MetadataAttributeSchemaList":{
4997+
"type":"list",
4998+
"member":{"shape":"MetadataAttributeSchema"},
4999+
"max":25,
5000+
"min":1
5001+
},
5002+
"MetadataConfigurationForReranking":{
5003+
"type":"structure",
5004+
"required":["selectionMode"],
5005+
"members":{
5006+
"selectionMode":{"shape":"RerankingMetadataSelectionMode"},
5007+
"selectiveModeConfiguration":{"shape":"RerankingMetadataSelectiveModeConfiguration"}
5008+
}
5009+
},
49205010
"MetricFloat":{
49215011
"type":"float",
49225012
"box":true
@@ -5633,6 +5723,21 @@
56335723
"min":0,
56345724
"pattern":"[a-zA-Z0-9\\s._:/=+$@-]{0,256}"
56355725
},
5726+
"RerankingMetadataSelectionMode":{
5727+
"type":"string",
5728+
"enum":[
5729+
"SELECTIVE",
5730+
"ALL"
5731+
]
5732+
},
5733+
"RerankingMetadataSelectiveModeConfiguration":{
5734+
"type":"structure",
5735+
"members":{
5736+
"fieldsToInclude":{"shape":"FieldsForReranking"},
5737+
"fieldsToExclude":{"shape":"FieldsForReranking"}
5738+
},
5739+
"union":true
5740+
},
56365741
"ResourceNotFoundException":{
56375742
"type":"structure",
56385743
"members":{
@@ -6224,6 +6329,41 @@
62246329
"agreementDuration":{"shape":"String"}
62256330
}
62266331
},
6332+
"VectorSearchBedrockRerankingConfiguration":{
6333+
"type":"structure",
6334+
"required":["modelConfiguration"],
6335+
"members":{
6336+
"modelConfiguration":{"shape":"VectorSearchBedrockRerankingModelConfiguration"},
6337+
"numberOfRerankedResults":{"shape":"VectorSearchBedrockRerankingConfigurationNumberOfRerankedResultsInteger"},
6338+
"metadataConfiguration":{"shape":"MetadataConfigurationForReranking"}
6339+
}
6340+
},
6341+
"VectorSearchBedrockRerankingConfigurationNumberOfRerankedResultsInteger":{
6342+
"type":"integer",
6343+
"box":true,
6344+
"max":100,
6345+
"min":1
6346+
},
6347+
"VectorSearchBedrockRerankingModelConfiguration":{
6348+
"type":"structure",
6349+
"required":["modelArn"],
6350+
"members":{
6351+
"modelArn":{"shape":"BedrockRerankingModelArn"},
6352+
"additionalModelRequestFields":{"shape":"AdditionalModelRequestFields"}
6353+
}
6354+
},
6355+
"VectorSearchRerankingConfiguration":{
6356+
"type":"structure",
6357+
"required":["type"],
6358+
"members":{
6359+
"type":{"shape":"VectorSearchRerankingConfigurationType"},
6360+
"bedrockRerankingConfiguration":{"shape":"VectorSearchBedrockRerankingConfiguration"}
6361+
}
6362+
},
6363+
"VectorSearchRerankingConfigurationType":{
6364+
"type":"string",
6365+
"enum":["BEDROCK_RERANKING_MODEL"]
6366+
},
62276367
"VpcConfig":{
62286368
"type":"structure",
62296369
"required":[

generator/ServiceModels/bedrock/bedrock-2023-04-20.docs.json

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"base": null,
104104
"refs": {
105105
"ExternalSourcesGenerationConfiguration$additionalModelRequestFields": "<p>Additional model parameters and their corresponding values not included in the text inference configuration for an external source. Takes in custom model parameters specific to the language model being used.</p>",
106-
"GenerationConfiguration$additionalModelRequestFields": "<p>Additional model parameters and corresponding values not included in the <code>textInferenceConfig</code> structure for a knowledge base. This allows you to provide custom model parameters specific to the language model being used.</p>"
106+
"GenerationConfiguration$additionalModelRequestFields": "<p>Additional model parameters and corresponding values not included in the <code>textInferenceConfig</code> structure for a knowledge base. This allows you to provide custom model parameters specific to the language model being used.</p>",
107+
"VectorSearchBedrockRerankingModelConfiguration$additionalModelRequestFields": "<p>A list of additional fields to include in the model request during reranking. These fields provide extra context or configuration options specific to the selected foundation model.</p>"
107108
}
108109
},
109110
"AdditionalModelRequestFieldsKey": {
@@ -151,6 +152,12 @@
151152
"UpdateMarketplaceModelEndpointRequest$endpointArn": "<p>The Amazon Resource Name (ARN) of the endpoint you want to update.</p>"
152153
}
153154
},
155+
"AttributeType": {
156+
"base": null,
157+
"refs": {
158+
"MetadataAttributeSchema$type": "<p>The data type of the metadata attribute. The type determines how the attribute can be used in filter expressions and reranking.</p>"
159+
}
160+
},
154161
"AuthorizationStatus": {
155162
"base": null,
156163
"refs": {
@@ -237,6 +244,7 @@
237244
"base": null,
238245
"refs": {
239246
"ExternalSourcesRetrieveAndGenerateConfiguration$modelArn": "<p>The Amazon Resource Name (ARN) of the foundation model or <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html\">inference profile</a> used to generate responses. </p>",
247+
"ImplicitFilterConfiguration$modelArn": "<p>The Amazon Resource Name (ARN) of the foundation model used for implicit filtering. This model processes the query to extract relevant filtering criteria.</p>",
240248
"KnowledgeBaseRetrieveAndGenerateConfiguration$modelArn": "<p>The Amazon Resource Name (ARN) of the foundation model or <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html\">inference profile</a> used to generate responses.</p>"
241249
}
242250
},
@@ -254,6 +262,12 @@
254262
"ListFoundationModelAgreementOffersResponse$modelId": "<p>Model Id of the foundation model.</p>"
255263
}
256264
},
265+
"BedrockRerankingModelArn": {
266+
"base": null,
267+
"refs": {
268+
"VectorSearchBedrockRerankingModelConfiguration$modelArn": "<p>The Amazon Resource Name (ARN) of the foundation model to use for reranking. This model processes the query and search results to determine a more relevant ordering.</p>"
269+
}
270+
},
257271
"Boolean": {
258272
"base": null,
259273
"refs": {
@@ -1053,6 +1067,25 @@
10531067
"RetrieveAndGenerateConfiguration$externalSourcesConfiguration": "<p>The configuration for the external source wrapper object in the <code>retrieveAndGenerate</code> function.</p>"
10541068
}
10551069
},
1070+
"FieldForReranking": {
1071+
"base": "<p>Specifies a field to be used during the reranking process in a Knowledge Base vector search. This structure identifies metadata fields that should be considered when reordering search results to improve relevance.</p>",
1072+
"refs": {
1073+
"FieldsForReranking$member": null
1074+
}
1075+
},
1076+
"FieldForRerankingFieldNameString": {
1077+
"base": null,
1078+
"refs": {
1079+
"FieldForReranking$fieldName": "<p>The name of the metadata field to be used during the reranking process.</p>"
1080+
}
1081+
},
1082+
"FieldsForReranking": {
1083+
"base": null,
1084+
"refs": {
1085+
"RerankingMetadataSelectiveModeConfiguration$fieldsToInclude": "<p>A list of metadata field names to explicitly include in the reranking process. Only these fields will be considered when reordering search results. This parameter cannot be used together with fieldsToExclude.</p>",
1086+
"RerankingMetadataSelectiveModeConfiguration$fieldsToExclude": "<p>A list of metadata field names to explicitly exclude from the reranking process. All metadata fields except these will be considered when reordering search results. This parameter cannot be used together with fieldsToInclude.</p>"
1087+
}
1088+
},
10561089
"FilterAttribute": {
10571090
"base": "<p>Specifies the name of the metadata attribute/field to apply filters. You must match the name of the attribute/field in your data source/document metadata.</p>",
10581091
"refs": {
@@ -2003,6 +2036,12 @@
20032036
"ByteContentDoc$identifier": "<p>The file name of the document contained in the wrapper object.</p>"
20042037
}
20052038
},
2039+
"ImplicitFilterConfiguration": {
2040+
"base": "<p>Configuration for implicit filtering in Knowledge Base vector searches. Implicit filtering allows you to automatically filter search results based on metadata attributes without requiring explicit filter expressions in each query.</p>",
2041+
"refs": {
2042+
"KnowledgeBaseVectorSearchConfiguration$implicitFilterConfiguration": "<p>Configuration for implicit filtering in Knowledge Base vector searches. This allows the system to automatically apply filters based on the query context without requiring explicit filter expressions.</p>"
2043+
}
2044+
},
20062045
"ImportedModelArn": {
20072046
"base": null,
20082047
"refs": {
@@ -2512,6 +2551,36 @@
25122551
"ModelInvocationJobSummary$message": "<p>If the batch inference job failed, this field contains a message describing why the job failed.</p>"
25132552
}
25142553
},
2554+
"MetadataAttributeSchema": {
2555+
"base": "<p>Defines the schema for a metadata attribute used in Knowledge Base vector searches. Metadata attributes provide additional context for documents and can be used for filtering and reranking search results.</p>",
2556+
"refs": {
2557+
"MetadataAttributeSchemaList$member": null
2558+
}
2559+
},
2560+
"MetadataAttributeSchemaDescriptionString": {
2561+
"base": null,
2562+
"refs": {
2563+
"MetadataAttributeSchema$description": "<p>An optional description of the metadata attribute that provides additional context about its purpose and usage.</p>"
2564+
}
2565+
},
2566+
"MetadataAttributeSchemaKeyString": {
2567+
"base": null,
2568+
"refs": {
2569+
"MetadataAttributeSchema$key": "<p>The unique identifier for the metadata attribute. This key is used to reference the attribute in filter expressions and reranking configurations.</p>"
2570+
}
2571+
},
2572+
"MetadataAttributeSchemaList": {
2573+
"base": null,
2574+
"refs": {
2575+
"ImplicitFilterConfiguration$metadataAttributes": "<p>A list of metadata attribute schemas that define the structure and properties of metadata fields used for implicit filtering. Each attribute defines a key, type, and optional description.</p>"
2576+
}
2577+
},
2578+
"MetadataConfigurationForReranking": {
2579+
"base": "<p>Configuration for how metadata should be used during the reranking process in Knowledge Base vector searches. This determines which metadata fields are included or excluded when reordering search results.</p>",
2580+
"refs": {
2581+
"VectorSearchBedrockRerankingConfiguration$metadataConfiguration": "<p>Configuration for how document metadata should be used during the reranking process. This determines which metadata fields are included when reordering search results.</p>"
2582+
}
2583+
},
25152584
"MetricFloat": {
25162585
"base": null,
25172586
"refs": {
@@ -3226,6 +3295,18 @@
32263295
"RequestMetadataMap$value": null
32273296
}
32283297
},
3298+
"RerankingMetadataSelectionMode": {
3299+
"base": null,
3300+
"refs": {
3301+
"MetadataConfigurationForReranking$selectionMode": "<p>The mode for selecting which metadata fields to include in the reranking process. Valid values are ALL (use all available metadata fields) or SELECTIVE (use only specified fields).</p>"
3302+
}
3303+
},
3304+
"RerankingMetadataSelectiveModeConfiguration": {
3305+
"base": "<p>Configuration for selectively including or excluding metadata fields during the reranking process. This allows you to control which metadata attributes are considered when reordering search results.</p>",
3306+
"refs": {
3307+
"MetadataConfigurationForReranking$selectiveModeConfiguration": "<p>Configuration for selective mode, which allows you to explicitly include or exclude specific metadata fields during reranking. This is only used when selectionMode is set to SELECTIVE.</p>"
3308+
}
3309+
},
32293310
"ResourceNotFoundException": {
32303311
"base": "<p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>",
32313312
"refs": {
@@ -3808,6 +3889,36 @@
38083889
"TermDetails$validityTerm": "<p>Describes the validity terms.</p>"
38093890
}
38103891
},
3892+
"VectorSearchBedrockRerankingConfiguration": {
3893+
"base": "<p>Configuration for using Amazon Bedrock foundation models to rerank Knowledge Base vector search results. This enables more sophisticated relevance ranking using large language models.</p>",
3894+
"refs": {
3895+
"VectorSearchRerankingConfiguration$bedrockRerankingConfiguration": "<p>Configuration for using Amazon Bedrock foundation models to rerank search results. This is required when the reranking type is set to BEDROCK.</p>"
3896+
}
3897+
},
3898+
"VectorSearchBedrockRerankingConfigurationNumberOfRerankedResultsInteger": {
3899+
"base": null,
3900+
"refs": {
3901+
"VectorSearchBedrockRerankingConfiguration$numberOfRerankedResults": "<p>The maximum number of results to rerank. This limits how many of the initial vector search results will be processed by the reranking model. A smaller number improves performance but may exclude potentially relevant results.</p>"
3902+
}
3903+
},
3904+
"VectorSearchBedrockRerankingModelConfiguration": {
3905+
"base": "<p>Configuration for the Amazon Bedrock foundation model used for reranking vector search results. This specifies which model to use and any additional parameters required by the model.</p>",
3906+
"refs": {
3907+
"VectorSearchBedrockRerankingConfiguration$modelConfiguration": "<p>Configuration for the Amazon Bedrock foundation model used for reranking. This includes the model ARN and any additional request fields required by the model.</p>"
3908+
}
3909+
},
3910+
"VectorSearchRerankingConfiguration": {
3911+
"base": "<p>Configuration for reranking vector search results to improve relevance. Reranking applies additional relevance models to reorder the initial vector search results based on more sophisticated criteria.</p>",
3912+
"refs": {
3913+
"KnowledgeBaseVectorSearchConfiguration$rerankingConfiguration": "<p>Configuration for reranking search results in Knowledge Base vector searches. Reranking improves search relevance by reordering initial vector search results using more sophisticated relevance models.</p>"
3914+
}
3915+
},
3916+
"VectorSearchRerankingConfigurationType": {
3917+
"base": null,
3918+
"refs": {
3919+
"VectorSearchRerankingConfiguration$type": "<p>The type of reranking to apply to vector search results. Currently, the only supported value is BEDROCK, which uses Amazon Bedrock foundation models for reranking.</p>"
3920+
}
3921+
},
38113922
"VpcConfig": {
38123923
"base": "<p>The configuration of a virtual private cloud (VPC). For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/usingVPC.html\">Protect your data using Amazon Virtual Private Cloud and Amazon Web Services PrivateLink</a>.</p>",
38133924
"refs": {

0 commit comments

Comments
 (0)