Posted On: Mar 28, 2024

Knowledge Bases for Amazon Bedrock is a fully managed Retrieval-Augmented Generation (RAG) capability that allows you to connect foundation models (FMs) to internal company data sources to deliver more relevant, context-specific, and accurate responses. Knowledge Bases now supports metadata filtering, which improves retrieval accuracy by ensuring the documents are relevant to the query. 

RAG applications process user queries by searching across a large set of documents. However, in many situations you may need to retrieve documents with specific attributes and/or content. With metadata filtering, users can narrow search results by specifying which documents to include or exclude from a query, resulting in more relevant responses generated by the FM. For example, to enhance the relevance of search results for a query like "How to file a claim" in a particular geography, you can apply a filter to retrieve only those documents pertaining to the particular state.

This capability allows you to define custom metadata attributes that filter search results before running a query. You can specify custom metadata for each corresponding document when ingesting data into the knowledge base. At launch, metadata attributes support boolean, string, double, and integer data types. Eight of the most common relational operators can be used for filtering, which are detailed in the documentation below. 

Metadata filtering is currently available in the US East (N. Virginia) and US West (Oregon) AWS Regions. To learn more about this feature and how to get started, refer to the Knowledge Bases for Amazon Bedrock documentation and visit the Amazon Bedrock console.