TOOL WIKI · DATA & RETRIEVAL
Unstructured
Parses and transforms documents into structured elements for downstream systems.
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
Preserve provenance, input format, and access-control metadata.
inputTo 02 · UnstructuredPreparing mixed document formats for search and retrieval. Inspect tables, headers, ordering, and source references after parsing.
processTo 03 · Prepared recordsValidate the component-specific output, including failed or empty records.
Store derived data with source version and deletion information.
Use compatible query processing and tenant-scoped filtering.
outputTo 06 · EvaluationCheck extraction quality, retrieval recall, and answer grounding separately.
Result or stopping point
Preparing mixed document formats for search and retrieval. Inspect tables, headers, ordering, and source references after parsing.
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.
python3 -m venv .venv
source .venv/bin/activate
pip install unstructuredTry a small integration
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
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
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
Explore the same layer
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.