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 unstructuredVerified import paths — ran on the pinned version, not inferred.
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.
Update imports from `from langchain.document_loaders import ...` to `from langchain_unstructured.document_loaders import ...` and ensure `langchain-unstructured` is installed.
Ensure `langchain-core` is updated to a compatible version (e.g., `pip install --upgrade langchain-core`) to avoid dependency conflicts or unexpected behavior.
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.
Set the `UNSTRUCTURED_API_KEY` environment variable before instantiating `UnstructuredAPIFileLoader`, or pass it directly via `unstructured_api_key` parameter.