Skip to content

Commit 12a1a9b

Browse files
author
AWS
committed
Amazon Bedrock Update: Add support for API Keys, Re-Ranker, implicit filter for RAG / KB evaluation for Bedrock APIs.
1 parent ae25af9 commit 12a1a9b

File tree

3 files changed

+214
-2
lines changed

3 files changed

+214
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "feature",
3+
"category": "Amazon Bedrock",
4+
"contributor": "",
5+
"description": "Add support for API Keys, Re-Ranker, implicit filter for RAG / KB evaluation for Bedrock APIs."
6+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"enableGenerateCompiledEndpointRules": true
2+
"enableGenerateCompiledEndpointRules": true,
3+
"enableEnvironmentBearerToken": true
34
}

services/bedrock/src/main/resources/codegen-resources/service-2.json

Lines changed: 206 additions & 1 deletion
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"],
@@ -1325,6 +1328,15 @@
13251328
"max":2048,
13261329
"min":0
13271330
},
1331+
"AttributeType":{
1332+
"type":"string",
1333+
"enum":[
1334+
"STRING",
1335+
"NUMBER",
1336+
"BOOLEAN",
1337+
"STRING_LIST"
1338+
]
1339+
},
13281340
"AuthorizationStatus":{
13291341
"type":"string",
13301342
"enum":[
@@ -1498,6 +1510,12 @@
14981510
"min":0,
14991511
"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}|)"
15001512
},
1513+
"BedrockRerankingModelArn":{
1514+
"type":"string",
1515+
"max":2048,
1516+
"min":1,
1517+
"pattern":"(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}::foundation-model/(.*))?"
1518+
},
15011519
"Boolean":{
15021520
"type":"boolean",
15031521
"box":true
@@ -3228,6 +3246,29 @@
32283246
},
32293247
"documentation":"<p>The configuration of the external source wrapper object in the <code>retrieveAndGenerate</code> function.</p>"
32303248
},
3249+
"FieldForReranking":{
3250+
"type":"structure",
3251+
"required":["fieldName"],
3252+
"members":{
3253+
"fieldName":{
3254+
"shape":"FieldForRerankingFieldNameString",
3255+
"documentation":"<p>The name of the metadata field to be used during the reranking process.</p>"
3256+
}
3257+
},
3258+
"documentation":"<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>"
3259+
},
3260+
"FieldForRerankingFieldNameString":{
3261+
"type":"string",
3262+
"max":2000,
3263+
"min":1
3264+
},
3265+
"FieldsForReranking":{
3266+
"type":"list",
3267+
"member":{"shape":"FieldForReranking"},
3268+
"max":100,
3269+
"min":1,
3270+
"sensitive":true
3271+
},
32313272
"FilterAttribute":{
32323273
"type":"structure",
32333274
"required":[
@@ -5687,6 +5728,24 @@
56875728
"min":1,
56885729
"sensitive":true
56895730
},
5731+
"ImplicitFilterConfiguration":{
5732+
"type":"structure",
5733+
"required":[
5734+
"metadataAttributes",
5735+
"modelArn"
5736+
],
5737+
"members":{
5738+
"metadataAttributes":{
5739+
"shape":"MetadataAttributeSchemaList",
5740+
"documentation":"<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>"
5741+
},
5742+
"modelArn":{
5743+
"shape":"BedrockModelArn",
5744+
"documentation":"<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>"
5745+
}
5746+
},
5747+
"documentation":"<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>"
5748+
},
56905749
"ImportedModelArn":{
56915750
"type":"string",
56925751
"max":1011,
@@ -6058,6 +6117,14 @@
60586117
"filter":{
60596118
"shape":"RetrievalFilter",
60606119
"documentation":"<p>Specifies the filters to use on the metadata fields in the knowledge base data sources before returning results.</p>"
6120+
},
6121+
"implicitFilterConfiguration":{
6122+
"shape":"ImplicitFilterConfiguration",
6123+
"documentation":"<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>"
6124+
},
6125+
"rerankingConfiguration":{
6126+
"shape":"VectorSearchRerankingConfiguration",
6127+
"documentation":"<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>"
60616128
}
60626129
},
60636130
"documentation":"<p>The configuration details for returning the results from the knowledge base vector search.</p>"
@@ -7024,6 +7091,63 @@
70247091
"min":0,
70257092
"sensitive":true
70267093
},
7094+
"MetadataAttributeSchema":{
7095+
"type":"structure",
7096+
"required":[
7097+
"key",
7098+
"type",
7099+
"description"
7100+
],
7101+
"members":{
7102+
"key":{
7103+
"shape":"MetadataAttributeSchemaKeyString",
7104+
"documentation":"<p>The unique identifier for the metadata attribute. This key is used to reference the attribute in filter expressions and reranking configurations.</p>"
7105+
},
7106+
"type":{
7107+
"shape":"AttributeType",
7108+
"documentation":"<p>The data type of the metadata attribute. The type determines how the attribute can be used in filter expressions and reranking.</p>"
7109+
},
7110+
"description":{
7111+
"shape":"MetadataAttributeSchemaDescriptionString",
7112+
"documentation":"<p>An optional description of the metadata attribute that provides additional context about its purpose and usage.</p>"
7113+
}
7114+
},
7115+
"documentation":"<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>",
7116+
"sensitive":true
7117+
},
7118+
"MetadataAttributeSchemaDescriptionString":{
7119+
"type":"string",
7120+
"max":1024,
7121+
"min":1,
7122+
"pattern":"[\\s\\S]+"
7123+
},
7124+
"MetadataAttributeSchemaKeyString":{
7125+
"type":"string",
7126+
"max":256,
7127+
"min":1,
7128+
"pattern":"[\\s\\S]+"
7129+
},
7130+
"MetadataAttributeSchemaList":{
7131+
"type":"list",
7132+
"member":{"shape":"MetadataAttributeSchema"},
7133+
"max":25,
7134+
"min":1
7135+
},
7136+
"MetadataConfigurationForReranking":{
7137+
"type":"structure",
7138+
"required":["selectionMode"],
7139+
"members":{
7140+
"selectionMode":{
7141+
"shape":"RerankingMetadataSelectionMode",
7142+
"documentation":"<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>"
7143+
},
7144+
"selectiveModeConfiguration":{
7145+
"shape":"RerankingMetadataSelectiveModeConfiguration",
7146+
"documentation":"<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>"
7147+
}
7148+
},
7149+
"documentation":"<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>"
7150+
},
70277151
"MetricFloat":{
70287152
"type":"float",
70297153
"box":true
@@ -8071,6 +8195,28 @@
80718195
"min":0,
80728196
"pattern":"[a-zA-Z0-9\\s._:/=+$@-]{0,256}"
80738197
},
8198+
"RerankingMetadataSelectionMode":{
8199+
"type":"string",
8200+
"enum":[
8201+
"SELECTIVE",
8202+
"ALL"
8203+
]
8204+
},
8205+
"RerankingMetadataSelectiveModeConfiguration":{
8206+
"type":"structure",
8207+
"members":{
8208+
"fieldsToInclude":{
8209+
"shape":"FieldsForReranking",
8210+
"documentation":"<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>"
8211+
},
8212+
"fieldsToExclude":{
8213+
"shape":"FieldsForReranking",
8214+
"documentation":"<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>"
8215+
}
8216+
},
8217+
"documentation":"<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>",
8218+
"union":true
8219+
},
80748220
"ResourceNotFoundException":{
80758221
"type":"structure",
80768222
"members":{
@@ -8938,6 +9084,65 @@
89389084
},
89399085
"documentation":"<p>Describes the validity terms.</p>"
89409086
},
9087+
"VectorSearchBedrockRerankingConfiguration":{
9088+
"type":"structure",
9089+
"required":["modelConfiguration"],
9090+
"members":{
9091+
"modelConfiguration":{
9092+
"shape":"VectorSearchBedrockRerankingModelConfiguration",
9093+
"documentation":"<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>"
9094+
},
9095+
"numberOfRerankedResults":{
9096+
"shape":"VectorSearchBedrockRerankingConfigurationNumberOfRerankedResultsInteger",
9097+
"documentation":"<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>"
9098+
},
9099+
"metadataConfiguration":{
9100+
"shape":"MetadataConfigurationForReranking",
9101+
"documentation":"<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>"
9102+
}
9103+
},
9104+
"documentation":"<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>"
9105+
},
9106+
"VectorSearchBedrockRerankingConfigurationNumberOfRerankedResultsInteger":{
9107+
"type":"integer",
9108+
"box":true,
9109+
"max":100,
9110+
"min":1
9111+
},
9112+
"VectorSearchBedrockRerankingModelConfiguration":{
9113+
"type":"structure",
9114+
"required":["modelArn"],
9115+
"members":{
9116+
"modelArn":{
9117+
"shape":"BedrockRerankingModelArn",
9118+
"documentation":"<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>"
9119+
},
9120+
"additionalModelRequestFields":{
9121+
"shape":"AdditionalModelRequestFields",
9122+
"documentation":"<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>"
9123+
}
9124+
},
9125+
"documentation":"<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>"
9126+
},
9127+
"VectorSearchRerankingConfiguration":{
9128+
"type":"structure",
9129+
"required":["type"],
9130+
"members":{
9131+
"type":{
9132+
"shape":"VectorSearchRerankingConfigurationType",
9133+
"documentation":"<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>"
9134+
},
9135+
"bedrockRerankingConfiguration":{
9136+
"shape":"VectorSearchBedrockRerankingConfiguration",
9137+
"documentation":"<p>Configuration for using Amazon Bedrock foundation models to rerank search results. This is required when the reranking type is set to BEDROCK.</p>"
9138+
}
9139+
},
9140+
"documentation":"<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>"
9141+
},
9142+
"VectorSearchRerankingConfigurationType":{
9143+
"type":"string",
9144+
"enum":["BEDROCK_RERANKING_MODEL"]
9145+
},
89419146
"VpcConfig":{
89429147
"type":"structure",
89439148
"required":[

0 commit comments

Comments
 (0)