Skip to main content
Filters restrict knowledge searches to documents matching specific criteria. Attach metadata when adding content, then filter by that metadata when searching.

Why Use Filters

  • Personalization: Retrieve documents for a specific user or group
  • Access control: Restrict searches to authorized content
  • Precision: Reduce noise by narrowing results to relevant documents

Manual Filtering

Pass filters explicitly when creating the agent or searching:
Multiple filters are combined with AND logic.

Agentic Filtering

Let the agent extract filters automatically from the query. The agent analyzes the user’s question and determines which filters to apply.
This requires a Contents DB to track available filter keys.

Manual vs Agentic Filtering

Traditional vs Agentic RAG

Filters work with both RAG approaches:
Use one approach at a time. Agentic RAG (search_knowledge=True) is recommended for most use cases.

Metadata Design

Good metadata enables effective filtering:
Tips:
  • Use consistent values (always "engineering", not sometimes "eng")
  • Include temporal data for time-based filtering
  • Add access levels for permission-based filtering

Supported Vector Databases

Filtering is supported on:
  • ChromaDB
  • LanceDB
  • Milvus
  • MongoDB
  • PgVector
  • Pinecone
  • Qdrant
  • Weaviate

Next Steps

Advanced Filtering

Complex filters with OR, NOT, and comparisons

Content DB

Required for agentic filtering

Search & Retrieval

How filtering affects search