What You’ll Build
Prerequisites
- A data connector with ingested and classified documents
- Python 3.9+ with
qdrant-client,fastembed, andopenaiinstalled
Step 1. Pull Chunk Text and File-Level Tags
Fetch each file’s tags withmetadata.list_paginated, then the chunk text with data_source.list_ingested_data. Each chunk record carries its file’s tag values.
Step 2. Embed and Index with Tags as Payload
Every chunk goes into the vector index with its tag values attached as payload fields.Step 3. Ask, with Optional Metadata Filters
The filter narrows the candidate pool before similarity search runs. Without it, retrieval considers every chunk in the corpus.Step 4. Compare Filtered and Unfiltered Retrieval
Run the same question both ways and measure how the filter narrows the candidate pool. Pick a filter value that actually exists in your data.Why Filtered Retrieval Wins
How to Use This
- Scope answers by any extracted tag. Pass
filters={"governing_law": "California"}or any other tag/value pair. - Swap the corpus. Change
CONNECTORandFILTERABLE_TAGS; the pipeline adapts to whatever tags exist. - Productionize. Point at a persistent Qdrant cluster instead of
:memory:, or skip the manual indexing entirely and usedata_slice.export_vdbas in the Clean Up a RAG Index. If your tag names contain spaces, slugify them before using them as payload keys; some vector stores cannot filter on keys with spaces.
Next Steps
Clean Up a RAG Index
Use the platform’s own vector export instead of indexing manually.
Taxonomies and Tags
Design the tags that power your filters.
Keep Answers Current Over Time
Keep the chatbot answering from current documents only.
Data Quality Gate
Feed the index only documents that pass quality checks.
