0Pricing
AI Agents · Lesson

Document Loaders and Parsers

Use LlamaHub loaders for 200+ source types, and parsers that preserve structure (tables, headings).

Document Loaders and Parsers is a free AI Agents lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AI Agents learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

LlamaIndex vs LangChain

LlamaIndex (formerly GPT-Index) is the other big agent framework. It focuses on RAG and document-centric agents.

Strengths: cleaner abstractions for index types, better PDF/structured-doc parsing, deep response-synthesis options.

Install

# pip install llama-index
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader

Easiest Path: SimpleDirectoryReader

documents = SimpleDirectoryReader('./docs').load_data()
print(f'{len(documents)} documents')
print(documents[0].text[:200])

LlamaHub

LlamaHub is a community registry of 200+ data loaders:

# pip install llama-index-readers-notion
from llama_index.readers.notion import NotionPageReader
reader = NotionPageReader(integration_token='...')
docs = reader.load_data(database_ids=['db-id'])

LlamaParse for PDFs

LlamaParse is the gold-standard PDF parser — handles tables, multi-column layouts, and math:

# pip install llama-parse
from llama_parse import LlamaParse
parser = LlamaParse(result_type='markdown', api_key='...')
docs = parser.load_data('handbook.pdf')

Tables Are Hard

Standard PDF parsers butcher tables. LlamaParse extracts them as proper Markdown tables — critical for financial / scientific docs.

Web Loaders

from llama_index.readers.web import SimpleWebPageReader
docs = SimpleWebPageReader().load_data(['https://example.com'])

Database Loaders

from llama_index.readers.database import DatabaseReader
reader = DatabaseReader(sql_database=SQLDatabase(engine))
docs = reader.load_data(query='SELECT * FROM articles')

Document Metadata

Every Document has metadata you can use for filtering and citations:

doc = documents[0]
print(doc.text)
print(doc.metadata)
# {'file_name': 'handbook.pdf', 'page_label': '1'}

Adding Custom Metadata

Enrich documents post-load:

for doc in documents:
    doc.metadata['department'] = 'engineering'
    doc.metadata['last_reviewed'] = '2024-08'

Excluding Metadata From the LLM

Some metadata is for filtering only, not for the LLM to see:

doc.excluded_llm_metadata_keys = ['internal_id', 'file_path']
# LLM still sees the text, but not those keys.

Async Loading

Many loaders support async for large batches:

docs = await reader.aload_data(['url1', 'url2', 'url3'])

LlamaParse Strength

What is LlamaParse known for?

Recap

SimpleDirectoryReader for quick starts, LlamaHub for SaaS sources, LlamaParse for serious PDFs. Document.metadata is your friend.

Frequently asked questions

Is the “Document Loaders and Parsers” lesson free?

Yes — the full text of “Document Loaders and Parsers” is free to read here on the web, and the AI Agents course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AI Agents course, upgrade to CoddyKit PRO.

What will I learn in “Document Loaders and Parsers”?

Use LlamaHub loaders for 200+ source types, and parsers that preserve structure (tables, headings). You practise AI Agents with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start AI Agents?

No prior experience is required. AI Agents on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Document Loaders and Parsers” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this AI Agents lesson?

Yes. Every AI Agents lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Document Loaders and Parsers
  2. The Index Hierarchy: Vector, Tree, Keyword
  3. Query Engines and Response Synthesis
  4. Sub-Question Decomposition Strategy
← Back to AI Agents