Skip to main content
Standard RAG search performs only question → vector similarity search. Dynamic filters first narrow scope by metadata then perform vector search, improving accuracy.

Example

Question: “Show me revenue trends from the Finance team’s 2024 reports”
MethodBehaviorResult
Without filterVector similarity over all documentsOther teams’ docs may be mixed in
With filterNarrow first by department=Finance, year=2024, then vector searchOnly relevant docs retrieved

How to Configure Filters

1

Define filter fields

On the Knowledge Base edit screen, click Add Filter to define a filter field.
ItemDescriptionExample
LabelFilter name shown to users”Department”, “Year”
TypeData typeEnum, Collection, Number, Date
OptionsAllowed values (Enum/Collection only)“Finance, HR, Engineering”
DescriptionDescription so the AI understands purpose”Indicates the document’s department”
Extraction promptInstruction for AI auto-extraction”Extract the department name from the filename”
RequiredShow orange warning when missingRequired check
2

Choose extraction mode

Toggle Manual / AI at the top of the filter schema.
Manual modeAI mode
Input methodUser enters per fileLLM auto-extracts from file content
Accuracy100% (human-entered)Depends on LLM performance
TimeProportional to file countOne-click bulk extraction
CostNoneLLM call cost
Recommended forFew files or accuracy-criticalMany files needing fast classification
AI-mode results can be edited manually. The most efficient flow is bulk-extract with AI first, then fix only the errors.
3

Save

Click Save to save the filter schema. In AI mode, metadata is auto-extracted on subsequent file uploads.

Filter Type Details

TypeSlotsMax CountSearch BehaviorUse Cases
Enumf_str_1 ~ f_str_44Exact matchDepartment, category, status
Collectionf_col_1 ~ f_col_44Match any one of multiple valuesTags, related teams
Numberf_int_1 ~ f_int_22Exact matchYear, version
Datef_date_1 ~ f_date_22Range searchCreated date, expiry date

Date Filter Input Format

Date filters accept varying precision:
InputMeaningSearch Range
2024All of 20242024-01-01 ~ 2024-12-31
2024-03March 20242024-03-01 ~ 2024-03-31
2024-03-15Specific dateThat day only

Metadata State Display

In the file list, each file’s metadata state is shown as a color dot.
ColorStateMeaning
🟢 GreenCompleteAll filter fields have values
🟡 YellowPartialOnly some fields are set
🟠 OrangeMissing RequiredRequired field is empty
Gray borderEmptyNo metadata set
🟣 Purple spinnerExtractingAI extraction in progress
Files in Orange (Missing Required) state may be omitted from filter searches. Make sure to fill in required fields.

AI Auto-Extraction

Writing Extraction Prompts

The extraction prompt is the instruction the AI uses when extracting metadata values from file content. Examples of good extraction prompts:
FilterExtraction Prompt
Department”Extract the department from document content or filename. Options: Finance, HR, Engineering”
Year”Extract the publication year from the document. If the filename contains a year, use it”
Document type”Determine the document type. Options: policy, guide, report, form”
The AI analyzes the first ~4,000 characters of the file. The closer key information is to the beginning, the better extraction accuracy.

Running Extraction

MethodDescriptionWhen to Use
Auto-extractionRuns automatically on uploadWhen AI mode is active and a new file is added
Single-file extractionFile metadata edit > Extract buttonRe-extract a specific file
Bulk extractionBulk extract button at the top of the KBRe-apply across all files after schema change

How Agents Use Filters

When you connect a KB with dynamic filters to an agent, auto-filtering happens through this flow.

Step Details

1

Inform the AI about filters

On agent start, the system reads the KB’s filter schema and auto-adds filter hints to the tool description.For example, with a “Department” filter, the AI knows “I can filter this KB by department”.
2

Extract filter values from the question

When a user asks a question, the AI auto-extracts filter values from the content.
Question: "Show me revenue trends from the Finance team's 2024 reports"

AI extraction:
  department → "Finance" (high confidence)
  year → 2024 (high confidence)
The AI only applies filters with high confidence. If filter values can’t be determined from the question, it falls back to standard vector search without filters.
3

Build the search filter

Extracted filter values are internally converted to a filter query the search engine understands.
User input: department=Finance, year=2024

Internal: f_str_1='Finance' AND f_int_1=2024

Passed to the search engine query
4

Run filtered search

The search engine performs vector similarity search only on documents matching the filter conditions. Documents from other teams or years are excluded from search.
5

Generate the answer

Filtered relevant documents are passed to the AI to generate an accurate answer.

Tool Description and Filters

The tool description is the key signal that helps the AI agent decide when to use a Knowledge Base, and which filter to apply.
Without Tool DescriptionWith Tool Description
KB selectionDecided by KB general description (may be inaccurate)Clear purpose guidance for accurate selection
Filter usageMay not know filters existKnows which filter to use in which situation
AI auto-generation recommended: Click the auto-generate button next to the tool description field — the AI drafts the tool description based on the KB name + description + file list + filter info.
After changing the filter schema, regenerate the tool description. New filter info must be reflected in the tool description for the AI to use filters accurately.

Caveats

AI extraction analyzes about the first 4,000 characters of the document — if key information is in later sections, extraction can be inaccurate. Review results and edit manually as needed.
Adding a filter field leaves existing files’ values empty. Run bulk extraction in AI mode to populate the new field. Removing a field also removes that metadata.
Slot counts are limited per type to optimize the search engine index structure:
  • Enum: max 4
  • Collection: max 4
  • Number: max 2
  • Date: max 2
Sufficient for most document classifications. If you need finer classification, consider splitting into separate Knowledge Bases.