liveBook · Manning

Document loader

As explained in AI Agents and Applications

A data loader is a component that ingests source data into a form suitable for downstream language-model processing.

A document loader brings external content into an LLM workflow. In LangChain, a source-specific loader extracts content from a file, web page, SaaS tool, or database and turns it into standardized Document objects. Each Document holds content and related metadata, giving later components a consistent input. section 1.2.1 section 1.7

For a retrieval-based Q&A application, ingestion typically proceeds as follows:

  • Choose a loader for the source. For CSV data, CsvLoader is one example; it parses the source into Document objects. section 7.1.1
  • Pass large Documents to a TextSplitter, which produces smaller Document chunks. An embedding model converts chunk text to vectors. section 7.1.1
  • Store chunks and embeddings in a vector store so a retriever can later find relevant context for an answer. section 7.1.1 section 1.2.1

Loading for summarization

To summarize content drawn from a Wikipedia page and local TXT, DOCX, and PDF files, select an appropriate DocumentLoader for each source. If the input is already a set of Documents, it need not be split merely to create the list; a large document may still need chunking. section 3.2.1

Keep the responsibilities separate: the loader imports content; it does not itself retrieve answers. This separation lets an application change its data connector without rebuilding the rest of the ingestion workflow. section 1.2 section 1.2.1

Figure 7.2 Content ingestion sequence diagram
figure

Follow the ingestion sequence to see where loading ends and splitting, embedding, and storage begin. section 7.1.1

How AI Agents and Applications covers it

How deep it goes
Defines the loader’s input and output and walks through its place in ingestion, without detailing loader implementation.
Examples
Uses a CSV ingestion flow and summarization inputs from Wikipedia plus local TXT, DOCX, and PDF files.
What you can do after
Apply it via LangChain’s source-specific DocumentLoader to prepare content for summarization or a retrieval pipeline.
How it connects
Connects Document objects to text splitters, embedding models, vector stores, retrievers, and retrieval-augmented generation.

Also explained in

Compare how 3 books explain document loader →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.