|
|
|
@ -1277,7 +1277,8 @@ def test_combining_sequences(
|
|
|
|
|
assert chain.first == prompt
|
|
|
|
|
assert chain.middle == [chat]
|
|
|
|
|
assert chain.last == parser
|
|
|
|
|
assert dumps(chain, pretty=True) == snapshot
|
|
|
|
|
if sys.version_info >= (3, 9):
|
|
|
|
|
assert dumps(chain, pretty=True) == snapshot
|
|
|
|
|
|
|
|
|
|
prompt2 = (
|
|
|
|
|
SystemMessagePromptTemplate.from_template("You are a nicer assistant.")
|
|
|
|
@ -2101,7 +2102,8 @@ async def test_llm_with_fallbacks(
|
|
|
|
|
assert await runnable.ainvoke("hello") == "bar"
|
|
|
|
|
assert await runnable.abatch(["hi", "hey", "bye"]) == ["bar"] * 3
|
|
|
|
|
assert list(await runnable.ainvoke("hello")) == list("bar")
|
|
|
|
|
assert dumps(runnable, pretty=True) == snapshot
|
|
|
|
|
if sys.version_info >= (3, 9):
|
|
|
|
|
assert dumps(runnable, pretty=True) == snapshot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FakeSplitIntoListParser(BaseOutputParser[List[str]]):
|
|
|
|
@ -2744,7 +2746,7 @@ async def test_runnable_branch_abatch() -> None:
|
|
|
|
|
@pytest.mark.skipif(
|
|
|
|
|
sys.version_info < (3, 9), reason="Requires python version >= 3.9 to run."
|
|
|
|
|
)
|
|
|
|
|
def test_reprsentation_of_runnables() -> None:
|
|
|
|
|
def test_representation_of_runnables() -> None:
|
|
|
|
|
"""Test representation of runnables."""
|
|
|
|
|
runnable = RunnableLambda(lambda x: x * 2)
|
|
|
|
|
assert repr(runnable) == "RunnableLambda(lambda x: x * 2)"
|
|
|
|
|