Home / Function/ test_trim_messages_last_30_include_system_allow_partial_end_on_human() — langchain Function Reference

test_trim_messages_last_30_include_system_allow_partial_end_on_human() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9d4887b6_7e00_f64b_819e_a611e050b9b9["test_trim_messages_last_30_include_system_allow_partial_end_on_human()"]
  03f6a5ae_d57a_eb66_626a_b9e082b763ea["test_utils.py"]
  9d4887b6_7e00_f64b_819e_a611e050b9b9 -->|defined in| 03f6a5ae_d57a_eb66_626a_b9e082b763ea
  style 9d4887b6_7e00_f64b_819e_a611e050b9b9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 384–407

def test_trim_messages_last_30_include_system_allow_partial_end_on_human() -> 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"),
    ]

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

    assert actual == expected
    assert _MESSAGES_TO_TRIM == _MESSAGES_TO_TRIM_COPY

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free