test_adds_system_prompt_when_none_exists() — langchain Function Reference
Architecture documentation for the test_adds_system_prompt_when_none_exists() function in test_todo.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b41781f2_6329_3441_aa0e_3bd08e9c4da8["test_adds_system_prompt_when_none_exists()"] d2f3bc2a_72aa_59d0_8558_330793eda010["test_todo.py"] b41781f2_6329_3441_aa0e_3bd08e9c4da8 -->|defined in| d2f3bc2a_72aa_59d0_8558_330793eda010 985809c4_2504_4ccb_3f22_07707d600f19["_make_request()"] b41781f2_6329_3441_aa0e_3bd08e9c4da8 -->|calls| 985809c4_2504_4ccb_3f22_07707d600f19 style b41781f2_6329_3441_aa0e_3bd08e9c4da8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py lines 82–101
def test_adds_system_prompt_when_none_exists() -> None:
"""Test that middleware adds system prompt when request has none."""
middleware = TodoListMiddleware()
request = _make_request(system_prompt=None)
captured_request = None
def mock_handler(req: ModelRequest) -> ModelResponse:
nonlocal captured_request
captured_request = req
return ModelResponse(result=[AIMessage(content="response")])
middleware.wrap_model_call(request, mock_handler)
# System prompt should be set in the modified request passed to handler
assert captured_request is not None
assert captured_request.system_prompt is not None
assert "write_todos" in captured_request.system_prompt
# Original request should be unchanged
assert request.system_prompt is None
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_adds_system_prompt_when_none_exists() do?
test_adds_system_prompt_when_none_exists() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py.
Where is test_adds_system_prompt_when_none_exists() defined?
test_adds_system_prompt_when_none_exists() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py at line 82.
What does test_adds_system_prompt_when_none_exists() call?
test_adds_system_prompt_when_none_exists() calls 1 function(s): _make_request.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free