Home / Function/ test_trim_messages_first_30() — langchain Function Reference

test_trim_messages_first_30() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 288–300

def test_trim_messages_first_30() -> None:
    expected = [
        SystemMessage("This is a 4 token text."),
        HumanMessage("This is a 4 token text.", id="first"),
    ]
    actual = trim_messages(
        _MESSAGES_TO_TRIM,
        max_tokens=30,
        token_counter=dummy_token_counter,
        strategy="first",
    )
    assert actual == expected
    assert _MESSAGES_TO_TRIM == _MESSAGES_TO_TRIM_COPY

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free