RAG
When not to use RAG
If it fits in context, changes every minute, or lives in a database, retrieval is the wrong tool.
What it is and why it exists
Whole-document tasks that fit the window are simpler with long context. Fast-changing facts (stock levels, order status) belong to an API or SQL call, not an index. Aggregations (“how many tickets last week”) need a query, not similarity search.
Quick prototype
—
In production, at scale
Route by question type: tool/API calls for live facts, text-to-SQL for aggregates, long context for single documents, RAG for knowledge lookup across many documents.
Vendors and tools
| Function calling / text-to-SQL | Live and structured data |
|---|
How it fails
- Indexing order status that is stale minutes later
- Asking a vector index to count
What the interviewer asks next
“How many refunds did we issue last month?” — RAG?
No: it’s an aggregate over structured data. Text-to-SQL or an analytics API with a read-only role.