Home / Function/ _get_image_from_data_content_block() — langchain Function Reference

_get_image_from_data_content_block() — langchain Function Reference

Architecture documentation for the _get_image_from_data_content_block() function in chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1883aa59_cdcf_1ce5_e67d_a17cd42ce5c1["_get_image_from_data_content_block()"]
  5b41b5a0_b415_2ecd_9522_191ca69202ca["chat_models.py"]
  1883aa59_cdcf_1ce5_e67d_a17cd42ce5c1 -->|defined in| 5b41b5a0_b415_2ecd_9522_191ca69202ca
  24455ecf_f2a0_74af_3dc1_500c0b6a35fa["_convert_messages_to_ollama_messages()"]
  24455ecf_f2a0_74af_3dc1_500c0b6a35fa -->|calls| 1883aa59_cdcf_1ce5_e67d_a17cd42ce5c1
  style 1883aa59_cdcf_1ce5_e67d_a17cd42ce5c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/langchain_ollama/chat_models.py lines 240–253

def _get_image_from_data_content_block(block: dict) -> str:
    """Format standard data content block to format expected by Ollama."""
    if block["type"] == "image":
        if block.get("source_type") == "base64":
            # v0 style
            return block["data"]
        if block.get("base64"):
            # v1 content blocks
            return block["base64"]
        error_message = "Image data only supported through in-line base64 format."
        raise ValueError(error_message)

    error_message = f"Blocks of type {block['type']} not supported."
    raise ValueError(error_message)

Domain

Subdomains

Frequently Asked Questions

What does _get_image_from_data_content_block() do?
_get_image_from_data_content_block() is a function in the langchain codebase, defined in libs/partners/ollama/langchain_ollama/chat_models.py.
Where is _get_image_from_data_content_block() defined?
_get_image_from_data_content_block() is defined in libs/partners/ollama/langchain_ollama/chat_models.py at line 240.
What calls _get_image_from_data_content_block()?
_get_image_from_data_content_block() is called by 1 function(s): _convert_messages_to_ollama_messages.

Analyze Your Own Codebase

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

Try Supermodel Free