LangChain Unstructured
Official LangChain integration for loading and chunking documents with Unstructured
Repository Health
Technical Analysis
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
UnstructuredLoaderimplementing LangChain’s document-loader interface for PDFs, Office formats, HTML, and other file types - A choice of local partitioning (via the open-source
unstructuredlibrary) 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.
Used by 2 apps in this directory
Langflow
AI Agents · AI Development
Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.
SurfSense
Search · AI Assistants
The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.