Home / Function/ _get_data_content_block_types() — langchain Function Reference

_get_data_content_block_types() — langchain Function Reference

Architecture documentation for the _get_data_content_block_types() function in content.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c790e000_5917_c7c6_0720_37dcb51f1c97["_get_data_content_block_types()"]
  c7f11daf_e104_efbe_7225_f1d6da8e8630["content.py"]
  c790e000_5917_c7c6_0720_37dcb51f1c97 -->|defined in| c7f11daf_e104_efbe_7225_f1d6da8e8630
  64c47965_895a_2cc2_b405_fe97d81684af["is_data_content_block()"]
  64c47965_895a_2cc2_b405_fe97d81684af -->|calls| c790e000_5917_c7c6_0720_37dcb51f1c97
  style c790e000_5917_c7c6_0720_37dcb51f1c97 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/messages/content.py lines 884–905

def _get_data_content_block_types() -> tuple[str, ...]:
    """Get type literals from DataContentBlock union members dynamically.

    Example: ("image", "video", "audio", "text-plain", "file")

    Note that old style multimodal blocks type literals with new style blocks.
    Specifically, "image", "audio", and "file".

    See the docstring of `_normalize_messages` in `language_models._utils` for details.
    """
    data_block_types = []

    for block_type in get_args(DataContentBlock):
        hints = get_type_hints(block_type)
        if "type" in hints:
            type_annotation = hints["type"]
            if hasattr(type_annotation, "__args__"):
                # This is a Literal type, get the literal value
                literal_value = type_annotation.__args__[0]
                data_block_types.append(literal_value)

    return tuple(data_block_types)

Domain

Subdomains

Frequently Asked Questions

What does _get_data_content_block_types() do?
_get_data_content_block_types() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/content.py.
Where is _get_data_content_block_types() defined?
_get_data_content_block_types() is defined in libs/core/langchain_core/messages/content.py at line 884.
What calls _get_data_content_block_types()?
_get_data_content_block_types() is called by 1 function(s): is_data_content_block.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free