Home / Function/ test_convert_to_v1_from_openai_input() — langchain Function Reference

test_convert_to_v1_from_openai_input() — langchain Function Reference

Architecture documentation for the test_convert_to_v1_from_openai_input() function in test_openai.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6c100c0e_9b63_f6a4_5af9_22d84f1b7e63["test_convert_to_v1_from_openai_input()"]
  71a6a26a_d6f8_432f_996a_21e56fcab4ae["test_openai.py"]
  6c100c0e_9b63_f6a4_5af9_22d84f1b7e63 -->|defined in| 71a6a26a_d6f8_432f_996a_21e56fcab4ae
  style 6c100c0e_9b63_f6a4_5af9_22d84f1b7e63 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/block_translators/test_openai.py lines 259–317

def test_convert_to_v1_from_openai_input() -> None:
    message = HumanMessage(
        content=[
            {"type": "text", "text": "Hello"},
            {
                "type": "image_url",
                "image_url": {"url": "https://example.com/image.png"},
            },
            {
                "type": "image_url",
                "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."},
            },
            {
                "type": "input_audio",
                "input_audio": {
                    "format": "wav",
                    "data": "<base64 string>",
                },
            },
            {
                "type": "file",
                "file": {
                    "filename": "draconomicon.pdf",
                    "file_data": "data:application/pdf;base64,<base64 string>",
                },
            },
            {
                "type": "file",
                "file": {"file_id": "<file id>"},
            },
        ]
    )

    expected: list[types.ContentBlock] = [
        {"type": "text", "text": "Hello"},
        {
            "type": "image",
            "url": "https://example.com/image.png",
        },
        {
            "type": "image",
            "base64": "/9j/4AAQSkZJRg...",
            "mime_type": "image/jpeg",
        },
        {
            "type": "audio",
            "base64": "<base64 string>",
            "mime_type": "audio/wav",
        },
        {
            "type": "file",
            "base64": "<base64 string>",
            "mime_type": "application/pdf",
            "extras": {"filename": "draconomicon.pdf"},
        },
        {"type": "file", "file_id": "<file id>"},
    ]

    assert _content_blocks_equal_ignore_id(message.content_blocks, expected)

Domain

Subdomains

Frequently Asked Questions

What does test_convert_to_v1_from_openai_input() do?
test_convert_to_v1_from_openai_input() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/block_translators/test_openai.py.
Where is test_convert_to_v1_from_openai_input() defined?
test_convert_to_v1_from_openai_input() is defined in libs/core/tests/unit_tests/messages/block_translators/test_openai.py at line 259.

Analyze Your Own Codebase

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

Try Supermodel Free