mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 04:50:37 +00:00
Extend test
This commit is contained in:
parent
9777c2801d
commit
fdcd50aab4
@ -1113,10 +1113,16 @@ def test_each(snapshot: SnapshotAssertion) -> None:
|
|||||||
+ "{question}"
|
+ "{question}"
|
||||||
)
|
)
|
||||||
first_llm = FakeStreamingListLLM(responses=["first item, second item, third item"])
|
first_llm = FakeStreamingListLLM(responses=["first item, second item, third item"])
|
||||||
|
parser = FakeSplitIntoListParser()
|
||||||
second_llm = FakeStreamingListLLM(responses=["this", "is", "a", "test"])
|
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
|
assert dumps(chain, pretty=True) == snapshot
|
||||||
output = chain.invoke({"question": "What up"})
|
output = chain.invoke({"question": "What up"})
|
||||||
assert output == ["this", "is", "a"]
|
assert output == ["this", "is", "a"]
|
||||||
|
|
||||||
|
assert (parser | second_llm.map()).invoke("first item, second item") == [
|
||||||
|
"test",
|
||||||
|
"this",
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user