Home / Function/ test_convert_to_v1_from_anthropic_input() — langchain Function Reference

test_convert_to_v1_from_anthropic_input() — langchain Function Reference

Architecture documentation for the test_convert_to_v1_from_anthropic_input() function in test_anthropic.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3c548fec_77c2_fb56_56b4_940c59374c0f["test_convert_to_v1_from_anthropic_input()"]
  c53716f9_76ec_0893_9384_3c7eaae0b0d1["test_anthropic.py"]
  3c548fec_77c2_fb56_56b4_940c59374c0f -->|defined in| c53716f9_76ec_0893_9384_3c7eaae0b0d1
  style 3c548fec_77c2_fb56_56b4_940c59374c0f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/block_translators/test_anthropic.py lines 393–509

def test_convert_to_v1_from_anthropic_input() -> None:
    message = HumanMessage(
        [
            {"type": "text", "text": "foo"},
            {
                "type": "document",
                "source": {
                    "type": "base64",
                    "data": "<base64 data>",
                    "media_type": "application/pdf",
                },
            },
            {
                "type": "document",
                "source": {
                    "type": "url",
                    "url": "<document url>",
                },
            },
            {
                "type": "document",
                "source": {
                    "type": "content",
                    "content": [
                        {"type": "text", "text": "The grass is green"},
                        {"type": "text", "text": "The sky is blue"},
                    ],
                },
                "citations": {"enabled": True},
            },
            {
                "type": "document",
                "source": {
                    "type": "text",
                    "data": "<plain text data>",
                    "media_type": "text/plain",
                },
            },
            {
                "type": "image",
                "source": {
                    "type": "base64",
                    "media_type": "image/jpeg",
                    "data": "<base64 image data>",
                },
            },
            {
                "type": "image",
                "source": {
                    "type": "url",
                    "url": "<image url>",
                },
            },
            {
                "type": "image",
                "source": {
                    "type": "file",
                    "file_id": "<image file id>",
                },
            },
            {
                "type": "document",
                "source": {"type": "file", "file_id": "<pdf file id>"},
            },
        ]
    )

    expected: list[types.ContentBlock] = [
        {"type": "text", "text": "foo"},
        {
            "type": "file",
            "base64": "<base64 data>",
            "mime_type": "application/pdf",
        },
        {
            "type": "file",
            "url": "<document url>",
        },
        {
            "type": "non_standard",
            "value": {

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free