Home / Function/ test_merge_message_runs_content() — langchain Function Reference

test_merge_message_runs_content() — langchain Function Reference

Architecture documentation for the test_merge_message_runs_content() function in test_utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  76c2ad26_5ad4_2dc6_5645_00a38cc88273["test_merge_message_runs_content()"]
  ea3f8d89_f44b_6738_3cb9_a740a73cfca4["test_utils.py"]
  76c2ad26_5ad4_2dc6_5645_00a38cc88273 -->|defined in| ea3f8d89_f44b_6738_3cb9_a740a73cfca4
  style 76c2ad26_5ad4_2dc6_5645_00a38cc88273 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 87–128

def test_merge_message_runs_content() -> None:
    messages = [
        AIMessage("foo", id="1"),
        AIMessage(
            [
                {"text": "bar", "type": "text"},
                {"image_url": "...", "type": "image_url"},
            ],
            tool_calls=[
                ToolCall(name="foo_tool", args={"x": 1}, id="tool1", type="tool_call")
            ],
            id="2",
        ),
        AIMessage(
            "baz",
            tool_calls=[
                ToolCall(name="foo_tool", args={"x": 5}, id="tool2", type="tool_call")
            ],
            id="3",
        ),
    ]
    messages_model_copy = [m.model_copy(deep=True) for m in messages]
    expected = [
        AIMessage(
            [
                "foo",
                {"text": "bar", "type": "text"},
                {"image_url": "...", "type": "image_url"},
                "baz",
            ],
            tool_calls=[
                ToolCall(name="foo_tool", args={"x": 1}, id="tool1", type="tool_call"),
                ToolCall(name="foo_tool", args={"x": 5}, id="tool2", type="tool_call"),
            ],
            id="1",
        ),
    ]
    actual = merge_message_runs(messages)
    assert actual == expected
    invoked = merge_message_runs().invoke(messages)
    assert actual == invoked
    assert messages == messages_model_copy

Subdomains

Frequently Asked Questions

What does test_merge_message_runs_content() do?
test_merge_message_runs_content() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/test_utils.py.
Where is test_merge_message_runs_content() defined?
test_merge_message_runs_content() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 87.

Analyze Your Own Codebase

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

Try Supermodel Free