mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
d3ec00b566
Co-authored-by: Nuno Campos <nuno@boringbits.io> Co-authored-by: Davis Chase <130488702+dev2049@users.noreply.github.com> Co-authored-by: Zander Chase <130414180+vowelparrot@users.noreply.github.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
15 lines
460 B
Python
15 lines
460 B
Python
"""Test LLM callbacks."""
|
|
from tests.unit_tests.callbacks.fake_callback_handler import FakeCallbackHandler
|
|
from tests.unit_tests.llms.fake_llm import FakeLLM
|
|
|
|
|
|
def test_llm_with_callbacks() -> None:
|
|
"""Test LLM callbacks."""
|
|
handler = FakeCallbackHandler()
|
|
llm = FakeLLM(callbacks=[handler], verbose=True)
|
|
output = llm("foo")
|
|
assert output == "foo"
|
|
assert handler.starts == 1
|
|
assert handler.ends == 1
|
|
assert handler.errors == 0
|