LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coremessagescontentImageContentBlock
    Class●Since v1.0

    ImageContentBlock

    Image data.

    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
    Copy
    ImageContentBlock()

    Bases

    TypedDict

    Constructors

    constructor
    __init__
    NameType
    typeLiteral['image']
    idNotRequired[str]
    file_idNotRequired[str]
    mime_typeNotRequired[str]
    indexNotRequired[int | str]
    urlNotRequired[str]
    base64NotRequired[str]
    extrasNotRequired[dict[str, Any]]

    Attributes

    attribute
    type: Literal['image']

    Type of the content block. Used for discrimination.

    attribute
    id: NotRequired[str]

    Unique identifier for this content block.

    Either:

    • Generated by the provider
    • Generated by LangChain upon creation (UUID4 prefixed with 'lc_'))
    attribute
    file_id: NotRequired[str]

    Reference to the image in an external file storage system.

    For example, OpenAI or Anthropic's Files API.

    attribute
    mime_type: NotRequired[str]

    MIME type of the image.

    Required for base64 data.

    Examples from IANA

    attribute
    index: NotRequired[int | str]

    Index of block in aggregate response. Used during streaming.

    attribute
    url: NotRequired[str]

    URL of the image.

    attribute
    base64: NotRequired[str]

    Data as a base64 string.

    attribute
    extras: NotRequired[dict[str, Any]]

    Provider-specific metadata. This shouldn't be used for the image data itself.

    View source on GitHub