Reports That Write Themselves: SQL for the Numbers, RAG for the Narrative
Monday-morning reports that write themselves: SQL pulls the numbers, RAG pulls the narrative context, an LLM composes commentary that is checked against the figures it cites, and the result lands in inboxes as a formatted document. The division of labor is the whole design: numbers come from the database, never from the model.
Key Takeaways
- The model never does arithmetic: every figure in the report is computed by SQL and referenced by ID, not regenerated as tokens.
- Narrative context comes from retrieval over real sources — meeting notes, tickets, docs — so commentary explains the numbers instead of decorating them.
- A verification pass compares prose against bound figures before anything ships; mismatches block the report, not the reader.
- Anomalies get first-class treatment: significant deviations from trend trigger a deeper drill-down section automatically.