Home / Function/ test_sequential_usage_memory() — langchain Function Reference

test_sequential_usage_memory() — langchain Function Reference

Architecture documentation for the test_sequential_usage_memory() function in test_sequential.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b5c4e8c6_0bcf_6207_d557_5143fd176b8b["test_sequential_usage_memory()"]
  0021bb47_51ab_bafd_26b4_c2849000554a["test_sequential.py"]
  b5c4e8c6_0bcf_6207_d557_5143fd176b8b -->|defined in| 0021bb47_51ab_bafd_26b4_c2849000554a
  style b5c4e8c6_0bcf_6207_d557_5143fd176b8b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_sequential.py lines 84–110

def test_sequential_usage_memory() -> None:
    """Test sequential usage with memory."""
    memory = SimpleMemory(memories={"zab": "rab"})
    chain_1 = FakeChain(input_variables=["foo"], output_variables=["bar"])
    chain_2 = FakeChain(input_variables=["bar"], output_variables=["baz"])
    chain = SequentialChain(  # type: ignore[call-arg]
        memory=memory,
        chains=[chain_1, chain_2],
        input_variables=["foo"],
    )
    output = chain({"foo": "123"})
    expected_output = {"baz": "123foofoo", "foo": "123", "zab": "rab"}
    assert output == expected_output
    memory = SimpleMemory(memories={"zab": "rab", "foo": "rab"})
    chain_1 = FakeChain(input_variables=["foo"], output_variables=["bar"])
    chain_2 = FakeChain(input_variables=["bar"], output_variables=["baz"])
    with pytest.raises(
        ValueError,
        match=re.escape(
            "Value error, The input key(s) foo are found in the Memory keys"
        ),
    ):
        SequentialChain(  # type: ignore[call-arg]
            memory=memory,
            chains=[chain_1, chain_2],
            input_variables=["foo"],
        )

Domain

Subdomains

Frequently Asked Questions

What does test_sequential_usage_memory() do?
test_sequential_usage_memory() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/chains/test_sequential.py.
Where is test_sequential_usage_memory() defined?
test_sequential_usage_memory() is defined in libs/langchain/tests/unit_tests/chains/test_sequential.py at line 84.

Analyze Your Own Codebase

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

Try Supermodel Free