mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 13:07:58 +00:00
.
This commit is contained in:
@@ -375,12 +375,12 @@ def test_cache_with_generation_objects() -> None:
|
|||||||
|
|
||||||
# Replace with Generation objects (missing message field)
|
# Replace with Generation objects (missing message field)
|
||||||
corrupted_generations = [
|
corrupted_generations = [
|
||||||
Generation(
|
Generation(
|
||||||
text=gen.text,
|
text=gen.text,
|
||||||
generation_info=gen.generation_info,
|
generation_info=gen.generation_info,
|
||||||
type="Generation", # This is the key - wrong type
|
type="Generation", # This is the key - wrong type
|
||||||
)
|
)
|
||||||
for gen in cached_chat_generations
|
for gen in cached_chat_generations
|
||||||
]
|
]
|
||||||
cache._cache[cache_key] = corrupted_generations
|
cache._cache[cache_key] = corrupted_generations
|
||||||
|
|
||||||
@@ -388,6 +388,8 @@ def test_cache_with_generation_objects() -> None:
|
|||||||
result2 = model.generate_response("test prompt")
|
result2 = model.generate_response("test prompt")
|
||||||
assert result2.generations[0].message.content == "hello"
|
assert result2.generations[0].message.content == "hello"
|
||||||
assert isinstance(result2.generations[0], ChatGeneration)
|
assert isinstance(result2.generations[0], ChatGeneration)
|
||||||
|
|
||||||
|
|
||||||
def test_cleanup_serialized() -> None:
|
def test_cleanup_serialized() -> None:
|
||||||
cleanup_serialized = {
|
cleanup_serialized = {
|
||||||
"lc": 1,
|
"lc": 1,
|
||||||
|
Reference in New Issue
Block a user