test_fetch_last_ai_and_tool_messages_normal() — langchain Function Reference
Architecture documentation for the test_fetch_last_ai_and_tool_messages_normal() function in test_fetch_last_ai_and_tool_messages.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 93adba86_bd68_0b22_1123_5d16348cd35c["test_fetch_last_ai_and_tool_messages_normal()"] 377b132d_d3e1_0d37_8fdd_618ce0d34bb1["test_fetch_last_ai_and_tool_messages.py"] 93adba86_bd68_0b22_1123_5d16348cd35c -->|defined in| 377b132d_d3e1_0d37_8fdd_618ce0d34bb1 style 93adba86_bd68_0b22_1123_5d16348cd35c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/test_fetch_last_ai_and_tool_messages.py lines 13–27
def test_fetch_last_ai_and_tool_messages_normal() -> None:
"""Test normal case with AIMessage and subsequent ToolMessages."""
messages = [
HumanMessage(content="Hello"),
AIMessage(content="Hi there!", tool_calls=[{"name": "test", "id": "1", "args": {}}]),
ToolMessage(content="Tool result", tool_call_id="1"),
]
ai_msg, tool_msgs = _fetch_last_ai_and_tool_messages(messages)
assert ai_msg is not None
assert isinstance(ai_msg, AIMessage)
assert ai_msg.content == "Hi there!"
assert len(tool_msgs) == 1
assert tool_msgs[0].content == "Tool result"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_fetch_last_ai_and_tool_messages_normal() do?
test_fetch_last_ai_and_tool_messages_normal() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_fetch_last_ai_and_tool_messages.py.
Where is test_fetch_last_ai_and_tool_messages_normal() defined?
test_fetch_last_ai_and_tool_messages_normal() is defined in libs/langchain_v1/tests/unit_tests/agents/test_fetch_last_ai_and_tool_messages.py at line 13.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free