Feature/add metadata filter to use case builder retrieve kb#1427
Open
takke1986 wants to merge 4 commits intoaws-samples:mainfrom
Open
Feature/add metadata filter to use case builder retrieve kb#1427takke1986 wants to merge 4 commits intoaws-samples:mainfrom
takke1986 wants to merge 4 commits intoaws-samples:mainfrom
Conversation
added 4 commits
January 30, 2026 22:20
…eBase tag
Add the ability to specify metadata filters in the {{retrieveKnowledgeBase}} tag
using a simple key=value format (e.g., {{retrieveKnowledgeBase:query:category=AWS}}).
Supported operators:
- = (equals), != (notEquals)
- >, <, >=, <= (numeric comparisons)
- ~= (stringContains), ^= (startsWith)
- @ (in), !@ (notIn) with | as value separator
The filters are automatically combined with existing hiddenStaticExplicitFilters
and dynamicFilters using AND logic. Backward compatible with existing usage.
Add USER_POOL_ID, USER_POOL_CLIENT_ID, USER_POOL_PROXY_ENDPOINT to retrieveKnowledgeBase Lambda for dynamic filter token verification
- Add filter syntax documentation to retrieveKnowledgeBase description - Add filter example (RAG with Filter) to help section - Support all languages: ja, en, zh, th, vi, ko - Korean: Add complete help section as it was missing
Update test snapshots to include USER_POOL_ID, USER_POOL_CLIENT_ID, and USER_POOL_PROXY_ENDPOINT in retrieveKnowledgeBase Lambda function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Please explain the changes in detail.
If there is any impact on existing users (compatibility, degradation, breaking changes, etc.), be sure to include it in the explanation.
Summary
Add the ability to specify metadata filters in the
{{retrieveKnowledgeBase}}tag using a simple key=value format.Features
{{retrieveKnowledgeBase:query:category=AWS,year>2020}}=(equals),!=(notEquals)>,<,>=,<=(numeric comparisons)~=(stringContains),^=(startsWith)@(in),!@(notIn) with|as value separatorChanges
RetrievalFilterobjectshiddenStaticExplicitFiltersanddynamicFiltersusing AND logic{{retrieveKnowledgeBase}}usage without filtersExample Usage
{{retrieveKnowledgeBase:Question:category=AWS,year>2020,tag@AWS|Bedrock|SageMaker}}
Checklist
npm run cdk:testand if there are snapshot differences, executenpm run cdk:test:update-snapshotto update snapshotsRelated Issues
#1416
Please list related issues as much as possible.