Home / Function/ test__construct_responses_api_input_human_message_with_image_url_conversion() — langchain Function Reference

test__construct_responses_api_input_human_message_with_image_url_conversion() — langchain Function Reference

Architecture documentation for the test__construct_responses_api_input_human_message_with_image_url_conversion() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  39543609_d3d2_123a_b84d_bc36b30c691b["test__construct_responses_api_input_human_message_with_image_url_conversion()"]
  48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"]
  39543609_d3d2_123a_b84d_bc36b30c691b -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5
  style 39543609_d3d2_123a_b84d_bc36b30c691b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 2167–2199

def test__construct_responses_api_input_human_message_with_image_url_conversion() -> (
    None
):
    """Test that human messages with image_url blocks are properly converted."""
    messages: list = [
        HumanMessage(
            content=[
                {"type": "text", "text": "What's in this image?"},
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://example.com/image.jpg",
                        "detail": "high",
                    },
                },
            ]
        )
    ]
    result = _construct_responses_api_input(messages)

    assert len(result) == 1
    assert result[0]["role"] == "user"
    assert isinstance(result[0]["content"], list)
    assert len(result[0]["content"]) == 2

    # Check text block conversion
    assert result[0]["content"][0]["type"] == "input_text"
    assert result[0]["content"][0]["text"] == "What's in this image?"

    # Check image block conversion
    assert result[0]["content"][1]["type"] == "input_image"
    assert result[0]["content"][1]["image_url"] == "https://example.com/image.jpg"
    assert result[0]["content"][1]["detail"] == "high"

Domain

Subdomains

Frequently Asked Questions

What does test__construct_responses_api_input_human_message_with_image_url_conversion() do?
test__construct_responses_api_input_human_message_with_image_url_conversion() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test__construct_responses_api_input_human_message_with_image_url_conversion() defined?
test__construct_responses_api_input_human_message_with_image_url_conversion() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 2167.

Analyze Your Own Codebase

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

Try Supermodel Free