Home / Function/ test_custom_system_prompt_async() — langchain Function Reference

test_custom_system_prompt_async() — langchain Function Reference

Architecture documentation for the test_custom_system_prompt_async() function in test_todo.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  9a4397ab_0f44_9548_7648_39e4b1072d88["test_custom_system_prompt_async()"]
  d2f3bc2a_72aa_59d0_8558_330793eda010["test_todo.py"]
  9a4397ab_0f44_9548_7648_39e4b1072d88 -->|defined in| d2f3bc2a_72aa_59d0_8558_330793eda010
  985809c4_2504_4ccb_3f22_07707d600f19["_make_request()"]
  9a4397ab_0f44_9548_7648_39e4b1072d88 -->|calls| 985809c4_2504_4ccb_3f22_07707d600f19
  style 9a4397ab_0f44_9548_7648_39e4b1072d88 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py lines 494–511

async def test_custom_system_prompt_async() -> None:
    """Test async version - middleware uses custom system prompt."""
    custom_prompt = "Custom planning instructions"
    middleware = TodoListMiddleware(system_prompt=custom_prompt)
    request = _make_request(system_prompt=None)

    captured_request = None

    async def mock_handler(req: ModelRequest) -> ModelResponse:
        nonlocal captured_request
        captured_request = req
        return ModelResponse(result=[AIMessage(content="response")])

    await middleware.awrap_model_call(request, mock_handler)

    # Should use custom prompt in the modified request passed to handler
    assert captured_request is not None
    assert captured_request.system_prompt == custom_prompt

Domain

Subdomains

Frequently Asked Questions

What does test_custom_system_prompt_async() do?
test_custom_system_prompt_async() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py.
Where is test_custom_system_prompt_async() defined?
test_custom_system_prompt_async() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py at line 494.
What does test_custom_system_prompt_async() call?
test_custom_system_prompt_async() 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