def test_query_pipeline_chain_str_intermediate_output() -> None:
    """Test add_chain with only module strings, showing intermediate outputs."""
    p = QueryPipeline(
        modules={
            "input": InputComponent(),
            "a": QueryComponent3(),
            "b": QueryComponent3(),
            "c": QueryComponent3(),
            "d": QueryComponent1(),
        },
    )
    p.add_links(
        [
            Link("input", "a", src_key="inp1", dest_key="input"),
            Link("input", "d", src_key="inp2", dest_key="input2"),
            Link("c", "d", dest_key="input1"),
        ]
    )
    p.add_chain(["a", "b", "c"])
    outputs, intermediates = p.run_with_intermediates(inp1=1, inp2=3)
    assert outputs == 11

    assert intermediates["input"].inputs == {"inp1": 1, "inp2": 3}
    assert intermediates["input"].outputs == {"inp1": 1, "inp2": 3}

    assert intermediates["a"].inputs == {"input": 1}
    assert intermediates["a"].outputs == {"output": 2}

    assert intermediates["b"].inputs == {"input": 2}
    assert intermediates["b"].outputs == {"output": 4}

    assert intermediates["c"].inputs == {"input": 4}
    assert intermediates["c"].outputs == {"output": 8}

    assert intermediates["d"].inputs == {"input1": 8, "input2": 3}
    assert intermediates["d"].outputs == {"output": 11}
Test add_chain with only module strings, showing intermediate outputs.
llama-index-core/tests/query_pipeline/test_query.py