Skip to content
ML Academy

LLMs, GenAI, RAG, agents, evaluation · insight-1535

Extract metadata filters from the query with a schema, and fall back to unfiltered search when they return nothing

Evidence type
practitioner heuristic
Difficulty
medium
Roles
Applied AI, ML engineer
Industries
aviation, e-commerce

Summary: situation, action, reason, boundary

  1. Situation

    Users type "IST-FRA business fares after March" and the index has route, cabin and effective-date fields that semantic search ignores.

  2. Action

    Parse the query into a typed filter object, validate values against the known vocabularies, apply them as hard filters, and when results fall below a minimum retry unfiltered while telling the generator which filter was dropped.

  3. Reason

    Filters turn entity mentions into exact constraints, but extraction itself is a fallible model step, so a failed or over-narrow filter must degrade gracefully.

  4. Boundary

    Catalogues, policy sets and ticket archives with reliable structured fields.

Symptom or risk

Unfiltered retrieval returns semantically close chunks from other routes, while a wrong extracted filter returns nothing and the assistant answers from thin air or refuses.

Exceptions

Queries where the entity is the answer, such as "which routes allow free changes".

Trade-offs

An extra parse step adds latency and a failure mode that needs its own tests.

Pitfalls

Silently dropping a filter, so the answer quotes a rule for the wrong route without any signal.

Lessons and concepts