How do you handle RAG over multi-format document collections?
Multi-format RAG requires robust document parsing for each format. PDFs use PyMuPDF, pdfplumber, or Unstructured for extraction with OCR fallback for scanned pages via Tesseract. Word documents use python-docx preserving formatting and structure. HTML uses BeautifulSoup or Trafilatura for clean text extraction. Spreadsheets use pandas to convert tabular data into text descriptions or structured summaries. Presentations use python-pptx extracting slide content with speaker notes. Images use vision models or OCR for text extraction. Audio and video use speech-to-text transcription. Unstructured.io provides a unified parsing library handling most formats. During indexing, preserve the source format as metadata so the system can cite specific page numbers in PDFs, slide numbers in presentations, or cell references in spreadsheets. Normalize extracted text to consistent formatting before embedding.