Report #102092
[architecture] How should tables and spreadsheets be included in a RAG pipeline?
Do not flatten tables into plain text. Keep rows intact with their column headers and surrounding section context, expose a structured representation \(HTML/Markdown/JSON\), and route aggregation or comparison questions to a text-to-SQL or code-generation agent instead of pure retrieval.
Journey Context:
Naive chunking splits table rows across chunks and destroys relational structure, so the LLM cannot compute sums, compare rows, or resolve references. Partition documents into structured elements \(Unstructured's Table elements, LlamaParse markdown tables, etc.\), attach schema metadata, and index each row with its context. For analytical questions, retrieval-only RAG is the wrong abstraction; a deterministic SQL or pandas layer over the actual data is far more reliable and auditable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:57:39.517808+00:00— report_created — created