Tool

Integrate Diverse File Types for LLM Data Ingestion

The default file-format loader bundle powering LlamaIndex's SimpleDirectoryReader.


70
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Seamlessly ingest and process a wide variety of file formats into your LLM applications. This asset provides robust readers for documents, presentations, images, and more, enabling comprehensive data indexing and retrieval.

Outcomes

What it gets done

01

Load data from PDF, DOCX, PPTX, and EPUB files.

02

Extract information from images, including captions and tabular data.

03

Process structured data from CSV and XML files.

04

Ingest content from HTML, Markdown, and MBOX formats.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-file | bash

Overview

LlamaIndex Readers Integration: File

The default bundle of 22 format-specific readers (PDF, Docx, Pptx, images, CSV, and more) that SimpleDirectoryReader dispatches to per file extension. Use whenever loading mixed-format files through SimpleDirectoryReader and needing format-specific parsing.

What it does

The File Readers Integration is the default integration for the different file-format loaders used within SimpleDirectoryReader, LlamaIndex's standard way of loading a folder of mixed files into documents. Rather than one reader per package, this single integration bundles a wide set of format-specific readers: DocxReader, HWPReader, PDFReader, EpubReader, FlatReader, HTMLTagReader, ImageCaptionReader, ImageReader, ImageVisionLLMReader, IPYNBReader, MarkdownReader, MboxReader, PptxReader, PandasCSVReader, VideoAudioReader, UnstructuredReader, PyMuPDFReader, ImageTabularChartReader, XMLReader, PagedCSVReader, CSVReader, and RTFReader - 22 readers covering documents, images, presentations, spreadsheets, notebooks, and more.

Each reader is used the same way: instantiate the specific reader class, map it to a file extension via a file_extractor dictionary, and pass that mapping to SimpleDirectoryReader so it dispatches each file to the right parser automatically. The source gives a worked example of this exact one-line swap for every individual reader in the bundle - PDF, Docx, HWP, Epub, Flat, HTML Tag, Image, IPYNB, Markdown, Mbox, Pptx, and Pandas CSV are each shown with their own parser = XReader() / file_extractor = {...} pair - so the pattern is consistent across formats rather than PDF being a special case. For example, PDFReader() mapped to .pdf, or ImageReader() mapped to .jpg/.jpeg/.png for multiple image formats in one dictionary. PptxReader supports both a basic mode (extracting text, tables, charts, and speaker notes) and an advanced mode with extract_images for image captioning, context_consolidation_with_llm for LLM-based content synthesis, num_workers and batch_size for parallel processing, and raise_on_error to fail loudly on a parsing error rather than silently skip it.

When to use - and when NOT to

Use it whenever you're loading a directory of mixed file types into LlamaIndex through SimpleDirectoryReader and need format-specific parsing beyond plain text - PDFs, Word documents, Korean HWP files, ebooks, spreadsheets, presentations, images, or Jupyter notebooks. Use PptxReader's advanced options specifically when you need image captioning or LLM-assisted content synthesis rather than raw text extraction, or when processing many slides in parallel. Do not reach for a separate reader package for these formats - this integration already covers them as the default backend for SimpleDirectoryReader.

Capabilities

22 format-specific readers (Docx, HWP, PDF, Epub, plain text, HTML tags, images with captioning or vision-LLM description, Jupyter notebooks, Markdown, Mbox, Pptx with basic or LLM-assisted advanced parsing, Pandas CSV, video/audio, Unstructured, PyMuPDF, image-tabular-chart, XML, paged CSV, CSV, and RTF), each wired into SimpleDirectoryReader via a file_extractor mapping.

How to install

pip install llama-index-readers-file

Who it's for

Developers building LlamaIndex pipelines that ingest mixed-format document collections and need the right parser automatically applied per file type, without assembling a separate reader package for each format.

Source README

LlamaIndex Readers Integration: File

pip install llama-index-readers-file

This is the default integration for different loaders that are used within SimpleDirectoryReader.

Provides support for the following loaders:

  • DocxReader
  • HWPReader
  • PDFReader
  • EpubReader
  • FlatReader
  • HTMLTagReader
  • ImageCaptionReader
  • ImageReader
  • ImageVisionLLMReader
  • IPYNBReader
  • MarkdownReader
  • MboxReader
  • PptxReader
  • PandasCSVReader
  • VideoAudioReader
  • UnstructuredReader
  • PyMuPDFReader
  • ImageTabularChartReader
  • XMLReader
  • PagedCSVReader
  • CSVReader
  • RTFReader

Installation

pip install llama-index-readers-file

Usage

Once installed, You can import any of the loader. Here's an example usage of one of the loader.

from llama_index.core import SimpleDirectoryReader
from llama_index.readers.file import (
    DocxReader,
    HWPReader,
    PDFReader,
    EpubReader,
    FlatReader,
    HTMLTagReader,
    ImageCaptionReader,
    ImageReader,
    ImageVisionLLMReader,
    IPYNBReader,
    MarkdownReader,
    MboxReader,
    PptxReader,
    PandasCSVReader,
    VideoAudioReader,
    UnstructuredReader,
    PyMuPDFReader,
    ImageTabularChartReader,
    XMLReader,
    PagedCSVReader,
    CSVReader,
    RTFReader,
)

#### PDF Reader with `SimpleDirectoryReader`
parser = PDFReader()
file_extractor = {".pdf": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### Docx Reader example
parser = DocxReader()
file_extractor = {".docx": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### HWP Reader example
parser = HWPReader()
file_extractor = {".hwp": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### Epub Reader example
parser = EpubReader()
file_extractor = {".epub": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### Flat Reader example
parser = FlatReader()
file_extractor = {".txt": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### HTML Tag Reader example
parser = HTMLTagReader()
file_extractor = {".html": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### Image Reader example
parser = ImageReader()
file_extractor = {
    ".jpg": parser,
    ".jpeg": parser,
    ".png": parser,
}  # Add other image formats as needed
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### IPYNB Reader example
parser = IPYNBReader()
file_extractor = {".ipynb": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### Markdown Reader example
parser = MarkdownReader()
file_extractor = {".md": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### Mbox Reader example
parser = MboxReader()
file_extractor = {".mbox": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### Pptx Reader example
#### Basic usage - extracts text, tables, charts, and speaker notes
parser = PptxReader()

#### Advanced usage - control parsing behavior
parser = PptxReader(
    extract_images=True,  # Enable image captioning
    context_consolidation_with_llm=True,  # Use LLM for content synthesis
    num_workers=4,  # Parallel processing
    batch_size=10,  # Slides processed per worker batch
    raise_on_error=True,  # Raise value error if file_parsing is not successful
)

file_extractor = {".pptx": parser}
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()


#### Pandas CSV Reader example
parser = PandasCSVReader()
file_extractor = {".csv": parser}  # Add other CSV formats as needed
documents = SimpleDirectoryReader(
    "./data", file_extractor=file_extractor
).load_data()

#### PyMuPDF Reader example
parser = PyMuPDFReader()

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.