LangChain Unstructured

Official LangChain integration for loading and chunking documents with Unstructured

SDK
PyPI
v1.0.1
22stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
58/100Fair
Development Activity88
Maintenance68
Community20
Maturity44
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
70/100Good
Architecture68
Code Quality70
Innovation55
Learning Curve85

langchain-unstructured is the official LangChain partner package that connects the Unstructured document-partitioning platform to LangChain’s document-loader interface. It exposes an UnstructuredLoader that can partition PDFs, Office documents, HTML, and other file types either locally via the open-source unstructured library or remotely via the hosted Unstructured API, returning LangChain Document objects ready for downstream RAG or LLM pipelines.

Beyond raw partitioning, the loader surfaces Unstructured’s chunking parameters (e.g. chunking_strategy="by_title", strategy="fast") directly as loader kwargs, so teams can go from raw files to retrieval-ready chunks in a single call without separately orchestrating partitioning and chunking steps.

What You Get

  • An UnstructuredLoader implementing LangChain’s document-loader interface for PDFs, Office formats, HTML, and other file types
  • A choice of local partitioning (via the open-source unstructured library) or hosted Unstructured API partitioning, controlled by a single flag
  • Direct access to Unstructured’s chunking parameters (chunking_strategy, strategy) as loader kwargs for RAG-ready output
  • Automatic file-type detection when loading local files without extra configuration
  • Type-checked (py.typed) integration maintained as an official LangChain partner package

Common Use Cases

  • Loading a mix of PDFs, Word docs, and HTML pages into a LangChain RAG pipeline with automatic file-type detection
  • Partitioning documents via the hosted Unstructured API when local extraction dependencies aren’t available or scaling is needed
  • Chunking documents by title/section during load (chunking_strategy="by_title") instead of adding a separate text-splitting step
  • Migrating an existing LangChain ingestion pipeline from a generic loader to Unstructured’s higher-fidelity document partitioning

Under The Hood

Architecture: The package is intentionally minimal — langchain_unstructured/document_loaders.py holds essentially all the logic, wrapping either the local unstructured.partition function or the unstructured-client SDK’s hosted API calls behind LangChain’s standard BaseLoader/load() contract, so the loader is interchangeable with any other LangChain document loader in a chain or pipeline.

Tech Stack: Python (>=3.10,<4.0), managed with Poetry, depending on langchain-core>=1.3.3 (pinned above known CVEs for SSRF/deserialization/path-traversal issues) and unstructured-client>=0.27.0 for the hosted-API path. The repo is a scoped LangChain partner-package monorepo (libs/unstructured/) containing exactly this one package, following the standard structure of langchain-ai’s other partner integrations.

Code Quality: 7 test files under libs/unstructured/tests/, a Makefile with lint/test targets consistent with other langchain-ai partner packages, and py.typed for typed consumption. As an official langchain-ai-maintained package it inherits that org’s CI and release conventions, though the repo’s own community footprint (22 stars) is small relative to core LangChain.

API Design: The loader follows LangChain’s document-loader convention exactly (loader.load() returns Document objects), so it’s a drop-in swap for any other loader in an existing chain — the only new surface is the partition_via_api/api_key/chunking kwargs, all optional with local partitioning as a sensible zero-config default. This keeps the learning curve low for anyone already using LangChain loaders.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search