fix caching (#555)

This commit is contained in:
Harrison Chase
2023-01-06 07:30:10 -08:00
committed by GitHub
parent 74932f2516
commit 9833fcfe32
2 changed files with 4 additions and 1 deletions

View File

@@ -14,6 +14,9 @@ def test_caching() -> None:
llm_string = str(sorted([(k, v) for k, v in params.items()]))
langchain.llm_cache.update("foo", llm_string, [Generation(text="fizz")])
output = llm.generate(["foo", "bar", "foo"])
expected_cache_output = [Generation(text="foo")]
cache_output = langchain.llm_cache.lookup("bar", llm_string)
assert cache_output == expected_cache_output
langchain.llm_cache = None
expected_generations = [
[Generation(text="fizz")],