support returning run info for llms, chat models and chains (#5666)

returning the run id is important for accessing the run later on
This commit is contained in:
Ankush Gola
2023-06-06 10:07:46 -07:00
committed by GitHub
parent 65111eb2b3
commit b177a29d3f
5 changed files with 74 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ import pytest
from langchain.callbacks.manager import CallbackManagerForChainRun
from langchain.chains.base import Chain
from langchain.schema import BaseMemory
from langchain.schema import RUN_KEY, BaseMemory
from tests.unit_tests.callbacks.fake_callback_handler import FakeCallbackHandler
@@ -72,6 +72,15 @@ def test_bad_outputs() -> None:
chain({"foo": "baz"})
def test_run_info() -> None:
"""Test that run_info is returned properly when specified"""
chain = FakeChain()
output = chain({"foo": "bar"}, include_run_info=True)
assert "foo" in output
assert "bar" in output
assert RUN_KEY in output
def test_correct_call() -> None:
"""Test correct call of fake chain."""
chain = FakeChain()