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_langchain_v0.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  65341c5e_9c69_4040_3d4a_64068fdfe192["test_convert_to_v1_from_openai_input()"]
  a210deb5_9c5f_af1b_1840_d884378a78aa["test_langchain_v0.py"]
  65341c5e_9c69_4040_3d4a_64068fdfe192 -->|defined in| a210deb5_9c5f_af1b_1840_d884378a78aa
  style 65341c5e_9c69_4040_3d4a_64068fdfe192 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/block_translators/test_langchain_v0.py lines 11–82

def test_convert_to_v1_from_openai_input() -> None:
    message = HumanMessage(
        content=[
            {"type": "text", "text": "Hello"},
            {
                "type": "image",
                "source_type": "url",
                "url": "https://example.com/image.png",
            },
            {
                "type": "image",
                "source_type": "base64",
                "data": "<base64 data>",
                "mime_type": "image/png",
            },
            {
                "type": "file",
                "source_type": "url",
                "url": "<document url>",
            },
            {
                "type": "file",
                "source_type": "base64",
                "data": "<base64 data>",
                "mime_type": "application/pdf",
            },
            {
                "type": "audio",
                "source_type": "base64",
                "data": "<base64 data>",
                "mime_type": "audio/mpeg",
            },
            {
                "type": "file",
                "source_type": "id",
                "id": "<file id>",
            },
        ]
    )

    expected: list[types.ContentBlock] = [
        {"type": "text", "text": "Hello"},
        {
            "type": "image",
            "url": "https://example.com/image.png",
        },
        {
            "type": "image",
            "base64": "<base64 data>",
            "mime_type": "image/png",
        },
        {
            "type": "file",
            "url": "<document url>",
        },
        {
            "type": "file",
            "base64": "<base64 data>",
            "mime_type": "application/pdf",
        },
        {
            "type": "audio",
            "base64": "<base64 data>",
            "mime_type": "audio/mpeg",
        },
        {
            "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_langchain_v0.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_langchain_v0.py at line 11.

Analyze Your Own Codebase

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

Try Supermodel Free