Skip to content
anythingai.space
Retrieval & RAGintermediate11 min · 8 steps

Code, Tables & Images in Context

Code, tables and page images break prose-style RAG. Chunk code by module, file and diff; then hand the model fenced code, trimmed tables and page images with their text.

def charge(…)which service? which file?Fee 2.5 3.0 Intlheaders lostPage 7 (scan)image droppedLLMguessing
errordatarequestresponse
1 / 8
ProblemStep 1 of 8

Prose-style RAG breaks on code, tables and pages

A function chunk with no file path can't say which service it belongs to. A table flattened to text loses which number sits under which header. A scanned contract page without its image loses signatures and stamps.

Structured content needs structure-aware chunking on the way in and structure-aware context assembly on the way to the model.

Lesson 30 of 37 in Retrieval & RAG