ImageContentBlock Class — langchain Architecture
Architecture documentation for the ImageContentBlock class in content.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD de677e7b_5f47_2ffb_2626_5e2dad79264f["ImageContentBlock"] c7f11daf_e104_efbe_7225_f1d6da8e8630["content.py"] de677e7b_5f47_2ffb_2626_5e2dad79264f -->|defined in| c7f11daf_e104_efbe_7225_f1d6da8e8630
Relationship Graph
Source Code
libs/core/langchain_core/messages/content.py lines 498–546
class ImageContentBlock(TypedDict):
"""Image data.
!!! note "Factory function"
`create_image_block` may also be used as a factory to create an
`ImageContentBlock`. Benefits include:
* Automatic ID generation (when not provided)
* Required arguments strictly validated at creation time
"""
type: Literal["image"]
"""Type of the content block. Used for discrimination."""
id: NotRequired[str]
"""Unique identifier for this content block.
Either:
- Generated by the provider
- Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
"""
file_id: NotRequired[str]
"""Reference to the image in an external file storage system.
For example, OpenAI or Anthropic's Files API.
"""
mime_type: NotRequired[str]
"""MIME type of the image.
Required for base64 data.
[Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#image)
"""
index: NotRequired[int | str]
"""Index of block in aggregate response. Used during streaming."""
url: NotRequired[str]
"""URL of the image."""
base64: NotRequired[str]
"""Data as a base64 string."""
extras: NotRequired[dict[str, Any]]
"""Provider-specific metadata. This shouldn't be used for the image data itself."""
Defined In
Source
Frequently Asked Questions
What is the ImageContentBlock class?
ImageContentBlock is a class in the langchain codebase, defined in libs/core/langchain_core/messages/content.py.
Where is ImageContentBlock defined?
ImageContentBlock is defined in libs/core/langchain_core/messages/content.py at line 498.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free