Home / Function/ test_input_dict_with_history_key() — langchain Function Reference

test_input_dict_with_history_key() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_history.py lines 169–194

def test_input_dict_with_history_key() -> None:
    runnable = RunnableLambda[Any, str](
        lambda params: (
            "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": "3"}}
    output = with_history.invoke({"input": "hello"}, config)
    assert output == "you said: hello"
    output = with_history.invoke({"input": "good bye"}, config)
    assert output == "you said: hello\ngood bye"

Domain

Subdomains

Frequently Asked Questions

What does test_input_dict_with_history_key() do?
test_input_dict_with_history_key() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_history.py.
Where is test_input_dict_with_history_key() defined?
test_input_dict_with_history_key() is defined in libs/core/tests/unit_tests/runnables/test_history.py at line 169.
What does test_input_dict_with_history_key() call?
test_input_dict_with_history_key() 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