Home / Function/ test_convert_to_v1_from_anthropic() — langchain Function Reference

test_convert_to_v1_from_anthropic() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/block_translators/test_anthropic.py lines 5–190

def test_convert_to_v1_from_anthropic() -> None:
    message = AIMessage(
        [
            {"type": "thinking", "thinking": "foo", "signature": "foo_signature"},
            {"type": "text", "text": "Let's call a tool."},
            {
                "type": "tool_use",
                "id": "abc_123",
                "name": "get_weather",
                "input": {"location": "San Francisco"},
            },
            {
                "type": "tool_use",
                "id": "abc_234",
                "name": "get_weather_programmatic",
                "input": {"location": "Boston"},
                "caller": {
                    "type": "code_execution_20250825",
                    "tool_id": "srvtoolu_abc234",
                },
            },
            {
                "type": "text",
                "text": "It's sunny.",
                "citations": [
                    {
                        "type": "search_result_location",
                        "cited_text": "The weather is sunny.",
                        "source": "source_123",
                        "title": "Document Title",
                        "search_result_index": 1,
                        "start_block_index": 0,
                        "end_block_index": 2,
                    },
                    {"bar": "baz"},
                ],
            },
            {
                "type": "server_tool_use",
                "name": "web_search",
                "input": {"query": "web search query"},
                "id": "srvtoolu_abc123",
            },
            {
                "type": "web_search_tool_result",
                "tool_use_id": "srvtoolu_abc123",
                "content": [
                    {
                        "type": "web_search_result",
                        "title": "Page Title 1",
                        "url": "<page url 1>",
                        "page_age": "January 1, 2025",
                        "encrypted_content": "<encrypted content 1>",
                    },
                    {
                        "type": "web_search_result",
                        "title": "Page Title 2",
                        "url": "<page url 2>",
                        "page_age": "January 2, 2025",
                        "encrypted_content": "<encrypted content 2>",
                    },
                ],
            },
            {
                "type": "server_tool_use",
                "id": "srvtoolu_def456",
                "name": "code_execution",
                "input": {"code": "import numpy as np..."},
            },
            {
                "type": "code_execution_tool_result",
                "tool_use_id": "srvtoolu_def456",
                "content": {
                    "type": "code_execution_result",
                    "stdout": "Mean: 5.5\nStandard deviation...",
                    "stderr": "",
                    "return_code": 0,
                },
            },
            {"type": "something_else", "foo": "bar"},
        ],

Domain

Subdomains

Frequently Asked Questions

What does test_convert_to_v1_from_anthropic() do?
test_convert_to_v1_from_anthropic() 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() defined?
test_convert_to_v1_from_anthropic() is defined in libs/core/tests/unit_tests/messages/block_translators/test_anthropic.py at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free