Home / Function/ test_output_messages_async() — langchain Function Reference

test_output_messages_async() — langchain Function Reference

Architecture documentation for the test_output_messages_async() function in test_history.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bfe5e716_b6ef_d97a_a9fd_0be800d4a225["test_output_messages_async()"]
  0af0dfde_fe33_f3e5_b5e6_a3d18260dc67["test_history.py"]
  bfe5e716_b6ef_d97a_a9fd_0be800d4a225 -->|defined in| 0af0dfde_fe33_f3e5_b5e6_a3d18260dc67
  e035a3b1_d1a1_c458_c801_af1fc0272f8b["_get_get_session_history()"]
  bfe5e716_b6ef_d97a_a9fd_0be800d4a225 -->|calls| e035a3b1_d1a1_c458_c801_af1fc0272f8b
  style bfe5e716_b6ef_d97a_a9fd_0be800d4a225 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_history.py lines 360–387

async def test_output_messages_async() -> None:
    runnable = RunnableLambda[Any, list[AIMessage]](
        lambda params: [
            AIMessage(
                content="you said: "
                + "\n".join(
                    [
                        str(m.content)
                        for m in params["history"]
                        if isinstance(m, HumanMessage)
                    ]
                    + [params["input"]]
                )
            )
        ]
    )
    get_session_history = _get_get_session_history()
    with_history = RunnableWithMessageHistory(
        runnable,
        get_session_history,
        input_messages_key="input",
        history_messages_key="history",
    )
    config: RunnableConfig = {"configurable": {"session_id": "6_async"}}
    output = await with_history.ainvoke({"input": "hello"}, config)
    assert output == [AIMessage(content="you said: hello")]
    output = await with_history.ainvoke({"input": "good bye"}, config)
    assert output == [AIMessage(content="you said: hello\ngood bye")]

Domain

Subdomains

Frequently Asked Questions

What does test_output_messages_async() do?
test_output_messages_async() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_history.py.
Where is test_output_messages_async() defined?
test_output_messages_async() is defined in libs/core/tests/unit_tests/runnables/test_history.py at line 360.
What does test_output_messages_async() call?
test_output_messages_async() calls 1 function(s): _get_get_session_history.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free