Registry / llm-agents / langchain-unstructured

langchain-unstructured

JSON →
library1.0.1pypypiunverified

langchain-unstructured is an integration package connecting the LangChain framework with Unstructured, a library for parsing and processing unstructured documents. It provides document loaders to extract text and metadata from various file types (PDFs, images, HTML, etc.) for use in LangChain applications. The current version is 1.0.1, with a release cadence that has recently seen a rapid transition to 1.x and subsequent minor updates.

pip install langchain-unstructured unstructured
INSTALL
IMPORT
SIG · LANGCHAIN-UNSTRUCT
L
langchain-unstructured
llm-agentspythonv1.0.1
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
4/8 runs
py 3.11
✕ timeout
4/8 runs
py 3.12
✕ build_error
4/8 runs
py 3.13
✕ build_error
6/8 runs
py 3.9
4/8 runs
4/8 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

UnstructuredFileLoader
from langchain_unstructured.document_loaders import UnstructuredFileLoader
UnstructuredAPIFileLoader
from langchain_unstructured.document_loaders import UnstructuredAPIFileLoader
from langchain.document_loaders import UnstructuredAPIFileLoader
As of v1.x, these loaders are part of the `langchain_unstructured` package, not `langchain` directly.

This quickstart demonstrates how to use `UnstructuredFileLoader` to load text from a local file. For more complex file types like PDFs or images, ensure you have the necessary `unstructured` extra dependencies installed (e.g., `pip install "unstructured[pdf]"`). For `UnstructuredAPIFileLoader`, ensure the `UNSTRUCTURED_API_KEY` environment variable is set.

import os from langchain_unstructured.document_loaders import UnstructuredFileLoader # Create a dummy file for demonstration with open("example.txt", "w") as f: f.write("This is a test document.\n") f.write("It contains some sample text to be loaded.") # Instantiate the loader for a local file loader = UnstructuredFileLoader("example.txt") # Load the document(s) docs = loader.load() # Print the content of the first loaded document if docs: print(f"Loaded {len(docs)} document(s).") print(f"Page content: {docs[0].page_content[:50]}...") print(f"Metadata: {docs[0].metadata}") # Clean up the dummy file os.remove("example.txt")
Debug
Known issues
breakingMigration from `langchain` document loaders to `langchain-unstructured` package.
fix
Update imports from `from langchain.document_loaders import ...` to `from langchain_unstructured.document_loaders import ...` and ensure `langchain-unstructured` is installed.
affects: 0.x to 1.x
breakingUpgrade of `langchain-core` dependency version in `langchain-unstructured` v1.0.0.
fix
Ensure `langchain-core` is updated to a compatible version (e.g., `pip install --upgrade langchain-core`) to avoid dependency conflicts or unexpected behavior.
affects: 1.0.0+
gotchaUnstructured requires additional dependencies for specific file types.
fix
For parsing PDFs, install `unstructured[pdf]` (e.g., `pip install "unstructured[pdf]"`). For images, `unstructured[image]` (which requires Tesseract OCR). Check the Unstructured documentation for specific requirements.
affects: All versions
gotchaUsing `UnstructuredAPIFileLoader` requires an API key.
fix
Set the `UNSTRUCTURED_API_KEY` environment variable before instantiating `UnstructuredAPIFileLoader`, or pass it directly via `unstructured_api_key` parameter.
affects: All versions
Upgrade
Version history
1.0.1latest on PyPI · released Dec 27, 2025
Audit
Dependencies
unstructuredrequiredCore dependency for local document processing. Requires various optional dependencies for different file types (e.g., 'unstructured[pdf]').
langchain-corerequiredFundamental LangChain dependency, crucial for loader functionality.
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
langchain-unstructured — pip install langchain-unstructured · libregistry