unstructured README

The project's README from github.com/Unstructured-IO/unstructured. As one markdown file: README.md.

https://pypi.python.org/pypi/unstructured/ https://pypi.python.org/pypi/unstructured/ https://GitHub.com/unstructured-io/unstructured.js/graphs/contributors code_of_conduct.md https://GitHub.com/unstructured-io/unstructured.js/releases https://github.com/Naereen/badges/ Downloads Downloads

Open-Source Pre-Processing Tools for Unstructured Data

The unstructured library provides open-source components for ingesting and pre-processing images and text documents, such as PDFs, HTML, Word docs, and many more. The use cases of unstructured revolve around streamlining and optimizing the data processing workflow for LLMs. unstructured modular functions and connectors form a cohesive system that simplifies data ingestion and pre-processing, making it adaptable to different platforms and efficient in transforming unstructured data into structured outputs.

Unstructured Transform MCP — Document Processing for your Agents

Unstructured Transform brings production-grade document processing to your agents as an MCP server. It gives them the ability to turn 60+ file types into structured data that's ready for your applications, vector databases, and any downstream processes by parsing, enriching, chunking, and embedding files directly inside their current session.

Setup Steps for Your Agent

  1. Pick your MCP client. Transform works with virtually any MCP-compatible host or agent framework — Claude Code, Cursor, Codex CLI and more.

  2. Add the Transform MCP server to your client's MCP configuration (via the CLI mcp add command or the client's MCP settings/config file, depending on the tool).

  3. Authenticate once when your client prompts you. Sign in, and the Transform tools become available to your agent on its next message.

  4. Point your agent at a file. Drag and drop or reference a local file or URL. Transform handles 60+ formats (PDFs, emails, images, scanned files, and more).

  5. Describe what you need in plain language. Tell the agent your intent (e.g. "parse and chunk this contract for a vector store") and Transform partitions, enriches, chunks, and embeds the file, returning structured data ready to use.

⚡ Get Started for Free

Unstructured Pipelines

Ready to move your data processing pipeline to production, and take advantage of advanced features? Check out Unstructured Pipelines. In addition to better processing performance, take advantage of chunking, embedding, and image and table enrichment generation, all from a low code UI or an API. Request a demo from our sales team to learn more about how to get started.

:eight_pointed_black_star: Quick Start

There are several ways to use the unstructured library:

Run the library in a container

The following instructions are intended to help you get up and running using Docker to interact with unstructured. See here if you don't already have docker installed on your machine.

NOTE: we build multi-platform images to support both x86_64 and Apple silicon hardware. docker pull should download the corresponding image for your architecture, but you can specify with --platform (e.g. --platform linux/amd64) if needed.

We build Docker images for all pushes to main. We tag each image with the corresponding short commit hash (e.g. fbc7a69) and the application version (e.g. 0.5.5-dev1). We also tag the most recent image with latest. To leverage this, docker pull from our image repository.

docker pull downloads.unstructured.io/unstructured-io/unstructured:latest

Once pulled, you can create a container from this image and shell to it.

# create the container
docker run -dt --name unstructured downloads.unstructured.io/unstructured-io/unstructured:latest

# this will drop you into a bash shell where the Docker image is running
docker exec -it unstructured bash

You can also build your own Docker image. Note that the base image is wolfi-base, which is updated regularly. If you are building the image locally, it is possible docker-build could fail due to upstream changes in wolfi-base.

If you only plan on parsing one type of data you can speed up building the image by commenting out some of the packages/requirements necessary for other data types. See Dockerfile to know which lines are necessary for your use case.

make docker-build

# this will drop you into a bash shell where the Docker image is running
make docker-start-bash

Once in the running container, you can try things directly in Python interpreter's interactive mode.

# this will drop you into a python console so you can run the below partition functions
python3

>>> from unstructured.partition.pdf import partition_pdf
>>> elements = partition_pdf(filename="example-docs/layout-parser-paper-fast.pdf")

>>> from unstructured.partition.text import partition_text
>>> elements = partition_text(filename="example-docs/fake-text.txt")

Installing the library

Use the following instructions to get up and running with unstructured and test your installation.

At this point, you should be able to run the following code:

from unstructured.partition.auto import partition

elements = partition(filename="example-docs/eml/fake-email.eml")
print("\n\n".join([str(el) for el in elements]))

Installation Instructions for Local Development

The following instructions are intended to help you get up and running with unstructured locally if you are planning to contribute to the project.

This project uses uv for dependency management. Install it first:

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

Then install all dependencies (base, extras, dev, test, and lint groups):

make install

This runs uv sync --locked --all-extras --all-groups, which creates a virtual environment and installs everything in one step. No need to manually create or activate a virtualenv.

To install only specific document-type extras:

uv sync --extra pdf
uv sync --extra csv --extra docx

To update the lock file after changing dependencies in pyproject.toml:

make lock

Additionally, if you're planning to contribute to unstructured, we provide you an optional pre-commit configuration file to ensure your code matches the formatting and linting standards used in unstructured. If you'd prefer not to have code changes auto-tidied before every commit, you can use make check to see whether any linting or formatting changes should be applied, and make tidy to apply them.

If using the optional pre-commit, you'll just need to install the hooks with pre-commit install since the pre-commit package is installed as part of make install mentioned above. Finally, if you decided to use pre-commit you can also uninstall the hooks with pre-commit uninstall.

In addition to develop in your local OS we also provide a helper to use docker providing a development environment:

make docker-start-dev

This starts a docker container with your local repo mounted to /mnt/local_unstructured. This docker image allows you to develop without worrying about your OS's compatibility with the repo and its dependencies.

:clap: Quick Tour

Documentation

For more comprehensive documentation, visit https://docs.unstructured.io . You can also learn more about our other products on the documentation page, including our SaaS API.

Here are a few pages from the Open Source documentation page that are helpful for new users to review:

PDF Document Parsing Example

The following examples show how to get started with the unstructured library. The easiest way to parse a document in unstructured is to use the partition function. If you use partition function, unstructured will detect the file type and route it to the appropriate file-specific partitioning function. If you are using the partition function, you may need to install additional dependencies per doc type. For example, to install docx dependencies you need to run pip install "unstructured[docx]". See our installation guide for more details.

from unstructured.partition.auto import partition

elements = partition("example-docs/layout-parser-paper.pdf")

Run print("\n\n".join([str(el) for el in elements])) to get a string representation of the output, which looks like:


LayoutParser : A Unified Toolkit for Deep Learning Based Document Image Analysis

Zejiang Shen 1 ( (cid:0) ), Ruochen Zhang 2 , Melissa Dell 3 , Benjamin Charles Germain Lee 4 , Jacob Carlson 3 , and
Weining Li 5

Abstract. Recent advances in document image analysis (DIA) have been primarily driven by the application of neural
networks. Ideally, research outcomes could be easily deployed in production and extended for further investigation.
However, various factors like loosely organized codebases and sophisticated model configurations complicate the easy
reuse of important innovations by a wide audience. Though there have been ongoing efforts to improve reusability and
simplify deep learning (DL) model development in disciplines like natural language processing and computer vision, none
of them are optimized for challenges in the domain of DIA. This represents a major gap in the existing toolkit, as DIA
is central to academic research across a wide range of disciplines in the social sciences and humanities. This paper
introduces LayoutParser, an open-source library for streamlining the usage of DL in DIA research and applications.
The core LayoutParser library comes with a set of simple and intuitive interfaces for applying and customizing DL models
for layout detection, character recognition, and many other document processing tasks. To promote extensibility,
LayoutParser also incorporates a community platform for sharing both pre-trained models and full document digitization
pipelines. We demonstrate that LayoutParser is helpful for both lightweight and large-scale digitization pipelines in
real-word use cases. The library is publicly available at https://layout-parser.github.io

Keywords: Document Image Analysis · Deep Learning · Layout Analysis · Character Recognition · Open Source library ·
Toolkit.

Introduction

Deep Learning(DL)-based approaches are the state-of-the-art for a wide range of document image analysis (DIA) tasks
including document image classification [11,

See the partitioning section in our documentation for a full list of options and instructions on how to use file-specific partitioning functions.

:guardsman: Security Policy

See our security policy for information on how to report security vulnerabilities.

:bug: Reporting Bugs

Encountered a bug? Please create a new GitHub issue and use our bug report template to describe the problem. To help us diagnose the issue, use the python scripts/collect_env.py command to gather your system's environment information and include it in your report. Your assistance helps us continuously improve our software - thank you!

:books: Learn more

Section Description
Company Website Unstructured.io product and company info
Documentation Full API documentation
Batch Processing Ingesting batches of documents through Unstructured

:chart_with_upwards_trend: Analytics

Unstructured sends lightweight analytics to GET https://packages.unstructured.io/python-telemetry by default: one library-load ping when it is imported and one best-effort local attempt for each top-level public partition call. The shared endpoint supports separate startup and runtime query-parameter schemas. Runtime events contain the package version, normalized platform/Python/architecture values, fixed-enum partition characteristics, and aggregate final-element counts as URL query parameters; there is no request body. They never contain document or element content, filenames, paths, URLs supplied for partitioning, raw MIME values, exception details, credentials, proxy configuration, or persistent installation, machine, process, account, user, or developer identifiers. Runtime delivery never waits on the network from partition processing, has no redirects, retries, response-body download, or queue, and does not consult proxy or netrc environment settings. At most one telemetry daemon can remain stranded in a network operation; later events drop while that slot is occupied, and process exit does not wait for it. Connect/read timeouts limit socket operations, not total network wall-clock duration.

To opt out before importing or partitioning, set either DO_NOT_TRACK or SCARF_NO_ANALYTICS to any non-empty value after trimming whitespace (for example, true, 1, yes, false, or 0); either variable disables both library-load and runtime telemetry. Unset the variables or leave them empty or whitespace-only to retain the default behavior. See our Privacy Policy.

unstructured (Unstructured-IO/unstructured)

Searching Database…

这是什么?Unstructured 是一个开源 ETL 工具包,可以把 PDF、Word 文档、HTML 和图片等复杂文档转换成干净的结构化数据(JSON),供大语言模型、RAG 流水线和向量数据库直接使用。
这是 Python 库、命令行工具,还是托管服务?它主要是一个 Python 库(pip install unstructured),核心是 'partition' 函数。此外,还有一个面向智能体的 MCP 服务器(Transform),以及一个单独收费的 Pipelines/SaaS 平台,供生产环境使用。
我该怎么把它跑起来?可以从 PyPI 安装:pip install "unstructured[all-docs]"(或者用更轻量的 pip install unstructured,只支持文本、HTML、JSON 和邮件)。也可以拉取预构建的 Docker 镜像,然后进入容器的命令行。本地开发请运行 uv sync --locked --all-extras --all-groups。
解析 PDF 或图片时,除了 Python 之外还需要额外的系统工具吗?需要。根据文件类型,你可能要安装 libmagic-dev、poppler-utils、tesseract-ocr 和 libreoffice 等系统软件包;pandoc 则会通过 pypandoc-binary 自动一并安装。
完整的文档版安装是不是很庞大?能不能只装我需要的部分?可以。你可以只安装需要的文档类型依赖,例如 pip install "unstructured[docx,pptx]";否则 all-docs 安装会为所有支持的格式都装上 OCR、Office 和 PDF 相关工具。
它在 Windows、Mac 和 Linux 上的表现都一样吗?是的,也提供了多平台 Docker 镜像,同时支持 x86_64 和 Apple Silicon。在 Windows 上使用 conda 安装时,文档中另有单独说明。
这个库会不会把我的文档数据发回去?它会发送极少量且可以关闭的遥测数据(加载时上报一次,每次调用 partition 时再上报一次),内容仅包括软件包版本、平台/架构和汇总的元素数量,绝不包括文档内容、文件名、路径或凭据。
Transform MCP 服务器是做什么用的?它把 Unstructured 的文档处理能力(支持 60 多种文件类型)以 MCP 工具的形式提供给 Claude Code、Cursor、Codex CLI 等智能体框架。智能体只需用自然语言描述意图,就能在当前会话中直接解析、增强、切块并向量化文件。
它开箱即用支持哪些文件类型?它支持 PDF、HTML、Word 文档、图片、邮件、JSON/XML 以及许多其他格式。MCP Transform 服务器可以处理 60 多种文件类型,包括扫描件。
不装任何额外东西,能解析多少种文档类型?纯文本、HTML、XML、JSON 和邮件文件,只需基础的 pip install unstructured 包即可解析,无需额外的系统依赖。
开源库和 Unstructured Pipelines 有什么区别?开源库免费,用于本地解析。Pipelines 是企业版产品,新增了切块、向量化、图片和表格增强功能,并提供低代码界面或 API,适用于生产规模的工作流,可通过销售演示获取。
Size
232.2 MB
Stars
15.6K
Age
4y
Commits · 90 Days