Home / Function/ test_trim_messages_start_on_with_allow_partial() — langchain Function Reference

test_trim_messages_start_on_with_allow_partial() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 659–677

def test_trim_messages_start_on_with_allow_partial() -> None:
    messages = [
        HumanMessage(content="First human message"),
        AIMessage(content="AI response"),
        HumanMessage(content="Second human message"),
    ]
    messages_copy = [m.model_copy(deep=True) for m in messages]
    result = trim_messages(
        messages,
        max_tokens=20,
        token_counter=dummy_token_counter,
        strategy="last",
        allow_partial=True,
        start_on="human",
    )

    assert len(result) == 1
    assert result[0].content == "Second human message"
    assert messages == messages_copy

Subdomains

Frequently Asked Questions

What does test_trim_messages_start_on_with_allow_partial() do?
test_trim_messages_start_on_with_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_start_on_with_allow_partial() defined?
test_trim_messages_start_on_with_allow_partial() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 659.

Analyze Your Own Codebase

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

Try Supermodel Free