Home / Function/ test_context_management_in_payload() — langchain Function Reference

test_context_management_in_payload() — langchain Function Reference

Architecture documentation for the test_context_management_in_payload() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8393e9a9_4e7d_bdb4_8d13_0be7b5913ff0["test_context_management_in_payload()"]
  18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"]
  8393e9a9_4e7d_bdb4_8d13_0be7b5913ff0 -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311
  style 8393e9a9_4e7d_bdb4_8d13_0be7b5913ff0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1552–1565

def test_context_management_in_payload() -> None:
    llm = ChatAnthropic(
        model=MODEL_NAME,  # type: ignore[call-arg]
        betas=["context-management-2025-06-27"],
        context_management={"edits": [{"type": "clear_tool_uses_20250919"}]},
    )
    llm_with_tools = llm.bind_tools(
        [{"type": "web_search_20250305", "name": "web_search"}]
    )
    input_message = HumanMessage("Search for recent developments in AI")
    payload = llm_with_tools._get_request_payload([input_message])  # type: ignore[attr-defined]
    assert payload["context_management"] == {
        "edits": [{"type": "clear_tool_uses_20250919"}]
    }

Domain

Subdomains

Frequently Asked Questions

What does test_context_management_in_payload() do?
test_context_management_in_payload() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py.
Where is test_context_management_in_payload() defined?
test_context_management_in_payload() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 1552.

Analyze Your Own Codebase

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

Try Supermodel Free