Skip to content

Commit 29fd87c

Browse files
author
AWS
committed
Agents for Amazon Bedrock Runtime Update: This release introduces filtering support on Retrieve and RetrieveAndGenerate APIs.
1 parent 81a91d2 commit 29fd87c

File tree

2 files changed

+125
-2
lines changed

2 files changed

+125
-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": "Agents for Amazon Bedrock Runtime",
4+
"contributor": "",
5+
"description": "This release introduces filtering support on Retrieve and RetrieveAndGenerate APIs."
6+
}

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

Lines changed: 119 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
{"shape":"AccessDeniedException"},
7777
{"shape":"ServiceQuotaExceededException"}
7878
],
79-
"documentation":"<p>Queries a knowledge base and generates responses based on the retrieved results. The response cites up to five sources but only selects the ones that are relevant to the query.</p>"
79+
"documentation":"<p>Queries a knowledge base and generates responses based on the retrieved results. The response only cites sources that are relevant to the query.</p>"
8080
}
8181
},
8282
"shapes":{
@@ -267,6 +267,35 @@
267267
"documentation":"<p>Contains information about the failure of the interaction.</p>",
268268
"sensitive":true
269269
},
270+
"FilterAttribute":{
271+
"type":"structure",
272+
"required":[
273+
"key",
274+
"value"
275+
],
276+
"members":{
277+
"key":{
278+
"shape":"FilterKey",
279+
"documentation":"<p>The name that the metadata attribute must match.</p>"
280+
},
281+
"value":{
282+
"shape":"FilterValue",
283+
"documentation":"<p>The value to whcih to compare the value of the metadata attribute.</p>"
284+
}
285+
},
286+
"documentation":"<p>Specifies the name that the metadata attribute must match and the value to which to compare the value of the metadata attribute. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html\">Query configurations</a>.</p> <p>This data type is used in the following API operations:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax\">RetrieveAndGenerate request</a> </p> </li> </ul>"
287+
},
288+
"FilterKey":{
289+
"type":"string",
290+
"max":100,
291+
"min":1
292+
},
293+
"FilterValue":{
294+
"type":"structure",
295+
"members":{
296+
},
297+
"document":true
298+
},
270299
"FinalResponse":{
271300
"type":"structure",
272301
"members":{
@@ -526,6 +555,10 @@
526555
"shape":"RetrievalResultLocation",
527556
"documentation":"<p>Contains information about the location of the data source.</p>"
528557
},
558+
"metadata":{
559+
"shape":"RetrievalResultMetadata",
560+
"documentation":"<p>Contains metadata attributes and their values for the file in the data source. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds.html#kb-ds-metadata\">Metadata and filtering</a>.</p>"
561+
},
529562
"score":{
530563
"shape":"Double",
531564
"documentation":"<p>The level of relevance of the result to the query.</p>"
@@ -567,6 +600,10 @@
567600
"KnowledgeBaseVectorSearchConfiguration":{
568601
"type":"structure",
569602
"members":{
603+
"filter":{
604+
"shape":"RetrievalFilter",
605+
"documentation":"<p>Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html\">Query configurations</a>.</p>"
606+
},
570607
"numberOfResults":{
571608
"shape":"KnowledgeBaseVectorSearchConfigurationNumberOfResultsInteger",
572609
"documentation":"<p>The number of source chunks to retrieve.</p>",
@@ -842,7 +879,7 @@
842879
"documentation":"<p>The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template.</p> <p>For more information, see the following resources:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html#kb-test-config-sysprompt\">Knowledge base prompt templates</a> </p> </li> <li> <p> <a href=\"https://docs.anthropic.com/claude/docs/use-xml-tags\">Use XML tags with Anthropic Claude models</a> </p> </li> </ul>"
843880
}
844881
},
845-
"documentation":"<p>Contains the template for the prompt that's sent to the model for response generation. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html#kb-test-config-sysprompt\">Knowledge base prompt templates</a>.</p> <p>This data type is used in the following API operations:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax\">RetrieveAndGenerate request</a> </p> </li> </ul>"
882+
"documentation":"<p>Contains the template for the prompt that's sent to the model for response generation. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html#kb-test-config-sysprompt\">Knowledge base prompt templates</a>.</p> <p>This data type is used in the following API operations:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax\">RetrieveAndGenerate request</a> – in the <code>filter</code> field</p> </li> </ul>"
846883
},
847884
"PromptText":{
848885
"type":"string",
@@ -964,6 +1001,64 @@
9641001
"documentation":"<p>The response from invoking the agent and associated citations and trace information.</p>",
9651002
"eventstream":true
9661003
},
1004+
"RetrievalFilter":{
1005+
"type":"structure",
1006+
"members":{
1007+
"andAll":{
1008+
"shape":"RetrievalFilterList",
1009+
"documentation":"<p>Knowledge base data sources whose metadata attributes fulfill all the filter conditions inside this list are returned.</p>"
1010+
},
1011+
"equals":{
1012+
"shape":"FilterAttribute",
1013+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value matches the <code>value</code> in this object are returned.</p>"
1014+
},
1015+
"greaterThan":{
1016+
"shape":"FilterAttribute",
1017+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than the <code>value</code> in this object are returned.</p>"
1018+
},
1019+
"greaterThanOrEquals":{
1020+
"shape":"FilterAttribute",
1021+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than or equal to the <code>value</code> in this object are returned.</p>"
1022+
},
1023+
"in":{
1024+
"shape":"FilterAttribute",
1025+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is in the list specified in the <code>value</code> in this object are returned.</p>"
1026+
},
1027+
"lessThan":{
1028+
"shape":"FilterAttribute",
1029+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is less than the <code>value</code> in this object are returned.</p>"
1030+
},
1031+
"lessThanOrEquals":{
1032+
"shape":"FilterAttribute",
1033+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is less than or equal to the <code>value</code> in this object are returned.</p>"
1034+
},
1035+
"notEquals":{
1036+
"shape":"FilterAttribute",
1037+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value doesn't match the <code>value</code> in this object are returned.</p>"
1038+
},
1039+
"notIn":{
1040+
"shape":"FilterAttribute",
1041+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value isn't in the list specified in the <code>value</code> in this object are returned.</p>"
1042+
},
1043+
"orAll":{
1044+
"shape":"RetrievalFilterList",
1045+
"documentation":"<p>Knowledge base data sources whose metadata attributes fulfill at least one of the filter conditions inside this list are returned.</p>"
1046+
},
1047+
"startsWith":{
1048+
"shape":"FilterAttribute",
1049+
"documentation":"<p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value starts with the <code>value</code> in this object are returned. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.</p>"
1050+
}
1051+
},
1052+
"documentation":"<p>Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html\">Query configurations</a>.</p> <p>This data type is used in the following API operations:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax\">Retrieve request</a> – in the <code>filter</code> field</p> </li> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax\">RetrieveAndGenerate request</a> – in the <code>filter</code> field</p> </li> </ul>",
1053+
"sensitive":true,
1054+
"union":true
1055+
},
1056+
"RetrievalFilterList":{
1057+
"type":"list",
1058+
"member":{"shape":"RetrievalFilter"},
1059+
"max":5,
1060+
"min":2
1061+
},
9671062
"RetrievalResultContent":{
9681063
"type":"structure",
9691064
"required":["text"],
@@ -996,6 +1091,24 @@
9961091
"type":"string",
9971092
"enum":["S3"]
9981093
},
1094+
"RetrievalResultMetadata":{
1095+
"type":"map",
1096+
"key":{"shape":"RetrievalResultMetadataKey"},
1097+
"value":{"shape":"RetrievalResultMetadataValue"},
1098+
"min":1,
1099+
"sensitive":true
1100+
},
1101+
"RetrievalResultMetadataKey":{
1102+
"type":"string",
1103+
"max":100,
1104+
"min":1
1105+
},
1106+
"RetrievalResultMetadataValue":{
1107+
"type":"structure",
1108+
"members":{
1109+
},
1110+
"document":true
1111+
},
9991112
"RetrievalResultS3Location":{
10001113
"type":"structure",
10011114
"members":{
@@ -1159,6 +1272,10 @@
11591272
"location":{
11601273
"shape":"RetrievalResultLocation",
11611274
"documentation":"<p>Contains information about the location of the data source.</p>"
1275+
},
1276+
"metadata":{
1277+
"shape":"RetrievalResultMetadata",
1278+
"documentation":"<p>Contains metadata attributes and their values for the file in the data source. For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds.html#kb-ds-metadata\">Metadata and filtering</a>.</p>"
11621279
}
11631280
},
11641281
"documentation":"<p>Contains metadata about a source cited for the generated response.</p> <p>This data type is used in the following API operations:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax\">RetrieveAndGenerate response</a> – in the <code>retrievedReferences</code> field</p> </li> <li> <p> <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax\">Retrieve response</a> – in the <code>retrievedReferences</code> field</p> </li> </ul>"

0 commit comments

Comments
 (0)