test_summarization_middleware_find_safe_cutoff_point_orphan_tool() — langchain Function Reference
Architecture documentation for the test_summarization_middleware_find_safe_cutoff_point_orphan_tool() function in test_summarization.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 7560d745_e956_e708_ea17_bf5eff9b9521["test_summarization_middleware_find_safe_cutoff_point_orphan_tool()"] 1911a463_b67d_0301_5ef1_5c535dafc14a["test_summarization.py"] 7560d745_e956_e708_ea17_bf5eff9b9521 -->|defined in| 1911a463_b67d_0301_5ef1_5c535dafc14a style 7560d745_e956_e708_ea17_bf5eff9b9521 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_summarization.py lines 823–839
def test_summarization_middleware_find_safe_cutoff_point_orphan_tool() -> None:
"""Test `_find_safe_cutoff_point` with truly orphan `ToolMessage` (no matching `AIMessage`)."""
model = FakeToolCallingModel()
middleware = SummarizationMiddleware(
model=model, trigger=("messages", 10), keep=("messages", 2)
)
# Messages where ToolMessage has no matching AIMessage at all
messages: list[AnyMessage] = [
HumanMessage(content="msg1"),
AIMessage(content="ai_no_tools"), # No tool_calls
ToolMessage(content="orphan_result", tool_call_id="orphan_call"),
HumanMessage(content="msg2"),
]
# Starting at orphan ToolMessage falls back to advancing forward
assert middleware._find_safe_cutoff_point(messages, 2) == 3
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_summarization_middleware_find_safe_cutoff_point_orphan_tool() do?
test_summarization_middleware_find_safe_cutoff_point_orphan_tool() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_summarization.py.
Where is test_summarization_middleware_find_safe_cutoff_point_orphan_tool() defined?
test_summarization_middleware_find_safe_cutoff_point_orphan_tool() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_summarization.py at line 823.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free