Home / Function/ test_simple_sequential_functionality_with_callbacks() — langchain Function Reference

test_simple_sequential_functionality_with_callbacks() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_sequential.py lines 209–242

async def test_simple_sequential_functionality_with_callbacks(
    *, is_async: bool
) -> None:
    """Test simple sequential functionality."""
    handler_1 = FakeCallbackHandler()
    handler_2 = FakeCallbackHandler()
    handler_3 = FakeCallbackHandler()
    chain_1 = FakeChain(
        input_variables=["foo"],
        output_variables=["bar"],
        callbacks=[handler_1],
    )
    chain_2 = FakeChain(
        input_variables=["bar"],
        output_variables=["baz"],
        callbacks=[handler_2],
    )
    chain_3 = FakeChain(
        input_variables=["jack"],
        output_variables=["baf"],
        callbacks=[handler_3],
    )
    chain = SimpleSequentialChain(chains=[chain_1, chain_2, chain_3])
    if is_async:
        output = await chain.ainvoke({"input": "123"})
    else:
        output = chain({"input": "123"})
    expected_output = {"output": "123foofoofoo", "input": "123"}
    assert output == expected_output
    # Check that each of the callbacks were invoked once per the entire run
    for handler in [handler_1, handler_2, handler_3]:
        assert handler.starts == 1
        assert handler.ends == 1
        assert handler.errors == 0

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free