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-corelanguage_models_utilsis_openai_data_block
    Function●Since v1.0

    is_openai_data_block

    Check whether a block contains multimodal data in OpenAI Chat Completions format.

    Supports both data and ID-style blocks (e.g. 'file_data' and 'file_id')

    If additional keys are present, they are ignored / will not affect outcome as long as the required keys are present and valid.

    Copy
    is_openai_data_block(
      block: dict,
      filter_: Literal['image', 'audio', 'file'] | None = None
    ) -> bool

    Parameters

    NameTypeDescription
    block*dict

    The content block to check.

    filter_Literal['image', 'audio', 'file'] | None
    Default:None

    If provided, only return True for blocks matching this specific type.

    • "image": Only match image_url blocks
    • "audio": Only match input_audio blocks
    • "file": Only match file blocks If None, match any valid OpenAI data block type. Note that this means that if the block has a valid OpenAI data type but the filter_ is set to a different type, this function will return False.
    View source on GitHub