--- id: docarray version: "0.41.0" license: Apache 2.0 license_treatment: permissive maintenance: active --- # docarray — The data structure for multimodal data License: permissive · Maintenance: active · Downloads: 109.0K/mo ## 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 above — 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 pip install docarray uv add docarray poetry add docarray ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 109.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags multimodal data structure, tensor data representation, document vector storage, machine learning data handling, nested document schema, batch tensor processing, pydantic-based data model, multimodal-data, tensor-handling, ml-data-structures [View on SkillFed](https://skillfed.io/packages/docarray) · [View on PyPI](https://pypi.org/project/docarray/)