diff --git a/libs/langchain/tests/unit_tests/schema/runnable/__snapshots__/test_runnable.ambr b/libs/langchain/tests/unit_tests/schema/runnable/__snapshots__/test_runnable.ambr index fe06e568f3c..828227fd308 100644 --- a/libs/langchain/tests/unit_tests/schema/runnable/__snapshots__/test_runnable.ambr +++ b/libs/langchain/tests/unit_tests/schema/runnable/__snapshots__/test_runnable.ambr @@ -545,6 +545,9 @@ } } } + ], + "input_variables": [ + "question" ] } }, 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 4f3e3b4b910..544b42da693 100644 --- a/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py +++ b/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py @@ -1106,6 +1106,17 @@ class FakeSplitIntoListParser(BaseOutputParser[List[str]]): return text.strip().split(", ") +def test_each_simple() -> None: + """Test that each() works with a simple runnable.""" + parser = FakeSplitIntoListParser() + assert parser.invoke("first item, second item") == ["first item", "second item"] + assert parser.map().invoke(["a, b", "c"]) == [["a", "b"], ["c"]] + assert parser.map().map().invoke([["a, b", "c"], ["c, e"]]) == [ + [["a", "b"], ["c"]], + [["c", "e"]], + ] + + def test_each(snapshot: SnapshotAssertion) -> None: prompt = ( SystemMessagePromptTemplate.from_template("You are a nice assistant.")