docarray
The data structure for multimodal data
What it is and what it does
DocArray is a Python library for defining, organizing, and working with multimodal data in machine learning workflows. It provides Pydantic-based schema definitions that let you declare document types with typed fields—including tensors with explicit shapes—and then collect them into vectorized or list-based containers for batch processing. The library integrates with NumPy and other tensor frameworks, and is designed to work seamlessly with web frameworks and microservice platforms.
You use DocArray when you need to represent complex, heterogeneous data (images, text, embeddings, metadata) in a structured way that mirrors how machine learning models consume it. It handles both single documents and bulk collections: DocVec stacks tensors for efficient batch operations, while DocList preserves individual tensor structures for streaming or re-ranking. The library also supports nested document composition and can serialize data as JSON over HTTP or Protobuf over gRPC.
Use it for:
- Define typed schemas for multimodal training data with tensor shape validation, then batch them for model training.
- Build API endpoints that accept and return structured multimodal documents with automatic validation.
- Organize and transmit image, text, and embedding data together in a single document structure for neural search applications.
- Compose nested document hierarchies (e.g., a document containing both image and text sub-documents) for complex data pipelines.
- Serialize multimodal collections to JSON or Protobuf for inter-service communication in microservice architectures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
DocArray provides a Python data structure for representing, transmitting, storing, and retrieving multimodal data, with built-in support for tensors from NumPy, PyTorch, TensorFlow, and JAX.
Yes. DocArray is actively maintained, has low install friction, carries a permissive Apache 2.0 license, and solves a real problem for machine learning workflows involving multimodal data. It integrates well with the Python ecosystem and is particularly valuable if you're building systems that need structured tensor and metadata handling. No known vulnerabilities.
Install
docarray on PyPI
pip
pip install docarrayuv
uv add docarraypoetry
poetry add docarrayInstalling docarray
Before you install
Low install friction with six runtime dependencies (pydantic, numpy, orjson, typing-inspect, types-requests, rich). Active maintenance with last commit on 2026-03-27 and 3125 repository stars.
License in practice
Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install docarray
from docarray import BaseDoc, DocVec
from docarray.typing import ImageUrl
import numpy as np
class MyDocument(BaseDoc):
description: str
image_url: ImageUrl
tensor: np.ndarray
vec = DocVec[MyDocument]([
MyDocument(
description="A cat",
image_url="https://example.com/cat.jpg",
tensor=np.zeros((3, 224, 224)),
)
])
Verify before relying
- Whether vector database integrations (Weaviate, Qdrant, ElasticSearch, Redis, Mongo Atlas, HNSWLib) are included in base install or require optional dependencies.
- Performance characteristics when working with very large document collections or high-dimensional tensors.
- Compatibility details with specific versions of PyTorch, TensorFlow, and JAX beyond the general native support claim.
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — pydantic, numpy, orjson, typing-inspect, types-requests, rich |
| Maintenance | actively maintained — 511 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 109,045/month — #12,531 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docarray-0.41.0-py3-none-any.whl
Keywords: docarray, deep-learning, data-structures cross-modal multi-modal, unstructured-data, nested-data, neural-search
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
tensordictTensorDict is a batched, nested dictionary…
permissive · top 5,000 on PyPI
tensordict-nightlyTensorDict is a batched, nested dictionary…
permissive · top 15,000 on PyPI
tensorlyTensorLy performs tensor decomposition, tensor…
permissive · top 15,000 on PyPI
autorayAutoray provides automatic dispatch of array…
permissive · top 15,000 on PyPI
kerasKeras 3 is a multi-backend deep learning…
permissive · top 5,000 on PyPI
safetensorsSerializes and deserializes tensors to and from…
permissive · top 1,000 on PyPI
numpydanticNumpydantic adds type annotations and…
permissive · top 15,000 on PyPI
xarrayxarray adds dimension, coordinate, and…
permissive · top 5,000 on PyPI
torchtypingAdds type annotations for PyTorch tensor shape,…
permissive · top 15,000 on PyPI
keras-nightlyA multi-backend deep learning framework that…
permissive · top 15,000 on PyPI