Home / File/ test_bedrock.py — langchain Source File

test_bedrock.py — langchain Source File

Architecture documentation for test_bedrock.py, a python file in the langchain codebase. 1 imports, 0 dependents.

File python CoreAbstractions MessageSchema 1 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  14c3df81_8729_62f6_f7bd_efb224c598fe["test_bedrock.py"]
  d758344f_537f_649e_f467_b9d7442e86df["langchain_core.messages"]
  14c3df81_8729_62f6_f7bd_efb224c598fe --> d758344f_537f_649e_f467_b9d7442e86df
  style 14c3df81_8729_62f6_f7bd_efb224c598fe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.messages import AIMessage, AIMessageChunk, HumanMessage
from langchain_core.messages import content as types


def test_convert_to_v1_from_bedrock() -> 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": "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": "something_else", "foo": "bar"},
        ],
        tool_calls=[
            {
                "type": "tool_call",
                "id": "abc_123",
                "name": "get_weather",
                "args": {"location": "San Francisco"},
            },
            {
                "type": "tool_call",
                "id": "abc_234",
                "name": "another_tool",
                "args": {"arg_1": "value_1"},
            },
        ],
        response_metadata={
            "model_provider": "bedrock",
            "model_name": "us.anthropic.claude-sonnet-4-20250514-v1:0",
        },
    )
    expected_content: list[types.ContentBlock] = [
        {
            "type": "reasoning",
            "reasoning": "foo",
            "extras": {"signature": "foo_signature"},
        },
        {"type": "text", "text": "Let's call a tool."},
        {
// ... (346 more lines)

Subdomains

Dependencies

  • langchain_core.messages

Frequently Asked Questions

What does test_bedrock.py do?
test_bedrock.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in test_bedrock.py?
test_bedrock.py defines 3 function(s): test_convert_to_v1_from_bedrock, test_convert_to_v1_from_bedrock_chunk, test_convert_to_v1_from_bedrock_input.
What does test_bedrock.py depend on?
test_bedrock.py imports 1 module(s): langchain_core.messages.
Where is test_bedrock.py in the architecture?
test_bedrock.py is located at libs/core/tests/unit_tests/messages/block_translators/test_bedrock.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/core/tests/unit_tests/messages/block_translators).

Analyze Your Own Codebase

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

Try Supermodel Free