langchain-unstructured
This package contains the LangChain integration with Unstructured
Installation
pip install -U langchain-unstructured
And you should configure credentials by setting the following environment variables:
export UNSTRUCTURED_API_KEY="your-api-key"
Loaders
Partition and load files using either the unstructured-client sdk and the
Unstructured API or locally using the unstructured library.
API:
To partition via the Unstructured API pip install unstructured-client and set
partition_via_api=True and define api_key. If you are running the unstructured API
locally, you can change the API rule by defining url when you initialize the
loader. The hosted Unstructured API requires an API key. See the links below to
learn more about our API offerings and get an API key.
Local:
By default the file loader uses the Unstructured partition function and will
automatically detect the file type.
In addition to document specific partition parameters, Unstructured has a rich set of "chunking" parameters for post-processing elements into more useful text segments for uses cases such as Retrieval Augmented Generation (RAG). You can pass additional Unstructured kwargs to the loader to configure different unstructured settings.
Setup:
pip install -U langchain-unstructured
pip install -U unstructured-client
export UNSTRUCTURED_API_KEY="your-api-key"
Instantiate:
from langchain_unstructured import UnstructuredLoader
loader = UnstructuredLoader(
file_path = ["example.pdf", "fake.pdf"],
api_key=UNSTRUCTURED_API_KEY,
partition_via_api=True,
chunking_strategy="by_title",
strategy="fast",
)
Load:
docs = loader.load()
print(docs[0].page_content[:100])
print(docs[0].metadata)
References
Release files for langchain-unstructured 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_unstructured-1.0.1.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_unstructured-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.4 kB
Release files / langchain_unstructured-1.0.1.tar.gz
| Download URL | langchain_unstructured-1.0.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b4b832b8fcdef8598ff634ec6fc0e344e6d8fdae854c5727f717d605d28e406
|
|
BLAKE2b-256 checksum How to use checksums |
de837d0821c03868d69c52a385891772a9c6f931a8a6cd7c16a2e397c01a5ee2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / langchain_unstructured-1.0.1-py3-none-any.whl
| Download URL | langchain_unstructured-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cdb00b3bccc05daa6f03bc3991b0a76270fd2fc095b358c23bd08c5f0e05f50
|
|
BLAKE2b-256 checksum How to use checksums |
cc17803613614fa4cec18d7dc9953a6029aa038ae4e693ef1b8375d08c30718c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|