Home / Function/ test_trim_messages_last_40_include_system_allow_partial() — langchain Function Reference

test_trim_messages_last_40_include_system_allow_partial() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 358–381

def test_trim_messages_last_40_include_system_allow_partial() -> None:
    expected = [
        SystemMessage("This is a 4 token text."),
        AIMessage(
            [
                {"type": "text", "text": "This is the SECOND 4 token block."},
            ],
            id="second",
        ),
        HumanMessage("This is a 4 token text.", id="third"),
        AIMessage("This is a 4 token text.", id="fourth"),
    ]

    actual = trim_messages(
        _MESSAGES_TO_TRIM,
        max_tokens=40,
        token_counter=dummy_token_counter,
        strategy="last",
        allow_partial=True,
        include_system=True,
    )

    assert actual == expected
    assert _MESSAGES_TO_TRIM == _MESSAGES_TO_TRIM_COPY

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free