BUGFIX: llm backwards compat imports (#13698)

This commit is contained in:
Bagatur
2023-11-21 20:12:35 -08:00
committed by GitHub
parent ace9e64d62
commit a21e84faf7
6 changed files with 54 additions and 18 deletions

View File

@@ -0,0 +1,19 @@
from tests.unit_tests.fake.llm import FakeListLLM
def test_batch() -> None:
llm = FakeListLLM(responses=["foo"] * 3)
output = llm.batch(["foo", "bar", "foo"])
assert output == ["foo"] * 3
output = llm.batch(["foo", "bar", "foo"], config={"max_concurrency": 2})
assert output == ["foo"] * 3
async def test_abatch() -> None:
llm = FakeListLLM(responses=["foo"] * 3)
output = await llm.abatch(["foo", "bar", "foo"])
assert output == ["foo"] * 3
output = await llm.abatch(["foo", "bar", "foo"], config={"max_concurrency": 2})
assert output == ["foo"] * 3