diff --git a/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py b/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py index c6630d7a6d6..ed40dec28d5 100644 --- a/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py +++ b/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py @@ -1113,10 +1113,16 @@ def test_each(snapshot: SnapshotAssertion) -> None: + "{question}" ) first_llm = FakeStreamingListLLM(responses=["first item, second item, third item"]) + parser = FakeSplitIntoListParser() second_llm = FakeStreamingListLLM(responses=["this", "is", "a", "test"]) - chain = prompt | first_llm | FakeSplitIntoListParser() | second_llm.map() + chain = prompt | first_llm | parser | second_llm.map() assert dumps(chain, pretty=True) == snapshot output = chain.invoke({"question": "What up"}) assert output == ["this", "is", "a"] + + assert (parser | second_llm.map()).invoke("first item, second item") == [ + "test", + "this", + ]