- Newest
- Most votes
- Most comments
Yes, you can integrate metadata filtering within your Bedrock workflow to refine the results of retrieval for a specific knowledge base. Here's how you can achieve this:
-
When setting up your knowledge base, ensure that you provide metadata files alongside your source data files. These metadata files should have the same name as the source files with a '.metadata.json' suffix.
-
In your workflow, when querying the specific knowledge base where you want to apply the metadata filter, you'll need to modify the retrieval configuration. You can do this by passing a filter to the 'retrievalConfiguration' parameter of the Retrieval API or RetrieveAndGenerate API.
-
The filter should be constructed using the metadata attributes you want to filter on. You can use various operators like equals, notEquals, greaterThan, lessThan, etc., depending on your filtering needs.
-
Here's an example of how you might structure the retrieval configuration with a metadata filter:
retrievalConfiguration={ "vectorSearchConfiguration": { "filter": your_metadata_filter } }
-
You can construct complex filters using multiple conditions if needed.
-
Apply this filtered retrieval to the specific knowledge base you want to refine, while keeping the other knowledge base queries as they are.
-
The results from this filtered retrieval will be more targeted and relevant based on your metadata criteria.
-
You can then proceed with your existing workflow, using these refined results along with the results from the other knowledge bases to generate your final response.
By implementing this approach, you'll be able to leverage metadata filtering to improve the accuracy and relevance of the information retrieved from your targeted knowledge base, while maintaining your overall workflow structure.
Sources
Knowledge Bases for Amazon Bedrock now supports metadata filtering to improve retrieval accuracy | AWS Machine Learning Blog
Amazon Bedrock Knowledge Bases now supports metadata filtering to improve retrieval accuracy | AWS Machine Learning Blog
Streamline RAG applications with intelligent metadata filtering using Amazon Bedrock | AWS Machine Learning Blog
Relevant content
asked 2 years ago

Does not answer the question. The question is specifically asking how to use Metadata Filtering with "FLOWS" and in retrieve or retrieveAndGenerate API.