TOOL WIKI · DATA & RETRIEVAL

Unstructured

Parses and transforms documents into structured elements for downstream systems.

Download example files Code + setup + checks in a ZIP
Jump to a section 10 sections

EXAMPLE USE CASE

Turn a policy HTML page into identifiable chunks

A policy assistant needs usable source text or relevant evidence before a generation model can answer a question reliably.

Input
The supplied policy.html with returns and shipping headings.
Expected output
Typed elements and chunks carrying source and chunk IDs.
  • Success check: The title and return-window text appear as typed elements before chunking.
  • Try a failure: Verify the 30-day condition survives chunking and remains attached to the correct source.

Example scope: Actual local parsing/chunking, not vector retrieval or answer generation.

Official reference · Unstructured

WHAT IT ISDocument processing platform
WHERE IT FITSData & retrieval
SEE HOW THE SYSTEM FITS TOGETHERSELECT A COMPONENT
inputprocessresultcheckoutputSource materialFiles or textUnstructuredDocument processing platformPrepared recordsText, chunks, or vectorsRetrieval storageIndex + metadataQuery pipelineScoped evidence lookupEvaluationInspect source fidelity
  1. Preserve provenance, input format, and access-control metadata.

  2. Preparing mixed document formats for search and retrieval. Inspect tables, headers, ordering, and source references after parsing.

  3. Validate the component-specific output, including failed or empty records.

  4. Store derived data with source version and deletion information.

  5. Use compatible query processing and tenant-scoped filtering.

  6. Check extraction quality, retrieval recall, and answer grounding separately.

    Result or stopping point
Unstructured

Preparing mixed document formats for search and retrieval. Inspect tables, headers, ordering, and source references after parsing.

Follow the arrows, then select a component to inspect its responsibility. On mobile, downward arrows connect the next step; bent arrows identify branches and return paths. Select a destination to jump to that component.

When to consider it

  • Preparing mixed document formats for search and retrieval.

A design decision to make

  • Inspect tables, headers, ordering, and source references after parsing.

Prerequisites and setup

  • Python 3.11+ and a scratch directory. Use the synthetic fixture or an approved test document.
Shell
python3 -m venv .venv
source .venv/bin/activate
pip install unstructured

Try a small integration

policy.html

HTML · policy.html
<!doctype html><html lang="en"><title>Returns policy</title><main><h1>Returns</h1><p>Returns are accepted within 30 days.</p><h2>Shipping</h2><p>Dispatch follows packing.</p></main></html>

partition.py

Python · partition.py
from unstructured.partition.html import partition_html
from unstructured.chunking.title import chunk_by_title

elements = partition_html(filename="policy.html")
for element in elements:
    print(element.category, str(element))
chunks = chunk_by_title(elements,max_characters=500)
for index,chunk in enumerate(chunks):
    print({"chunk_id":f"policy-v1-{index}","text":str(chunk),"source":"policy.html"})

Run and check the result

Shell
python partition.py
  • The title and return-window text appear as typed elements before chunking.
  • Chunk IDs retain a source/version mapping; boundaries should follow the content’s structure.

Common failures

  • A successful parse job does not prove table/reading-order accuracy; compare output with the original page.
  • Enforce file-size, duration and memory limits. Treat extracted text as untrusted content rather than instructions.

Production decisions

  • Preserve document ID, version, page/section, access scope and parser/model configuration alongside each chunk or vector.
  • Evaluate extraction and retrieval separately. Test tables, scans, empty documents, duplicates, malformed input and source deletion.

Keep exploring

Retrieval that can ask a better questionA context pipeline for a long-running agent

Explore the same layer

DoclingLlamaParseSentence TransformersCohere Rerank

Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.