Home / Function/ test_appends_to_existing_system_prompt_async() — langchain Function Reference

test_appends_to_existing_system_prompt_async() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py lines 469–491

async def test_appends_to_existing_system_prompt_async() -> None:
    """Test async version - middleware appends to existing system prompt."""
    existing_prompt = "You are a helpful assistant."
    middleware = TodoListMiddleware()
    request = _make_request(system_prompt=existing_prompt)

    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)

    # System prompt should contain both in the modified request passed to handler
    assert captured_request is not None
    assert captured_request.system_prompt is not None
    assert existing_prompt in captured_request.system_prompt
    assert "write_todos" in captured_request.system_prompt
    assert captured_request.system_prompt.startswith(existing_prompt)
    # Original request should be unchanged
    assert request.system_prompt == existing_prompt

Domain

Subdomains

Frequently Asked Questions

What does test_appends_to_existing_system_prompt_async() do?
test_appends_to_existing_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_appends_to_existing_system_prompt_async() defined?
test_appends_to_existing_system_prompt_async() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_todo.py at line 469.
What does test_appends_to_existing_system_prompt_async() call?
test_appends_to_existing_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