mirror of
https://github.com/hwchase17/langchain.git
synced 2025-10-12 12:31:00 +00:00
Harrison/llm saving (#331)
Co-authored-by: Akash Samant <70665700+asamant21@users.noreply.github.com>
This commit is contained in:
16
tests/integration_tests/llms/utils.py
Normal file
16
tests/integration_tests/llms/utils.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Utils for LLM Tests."""
|
||||
|
||||
from langchain.llms.base import LLM
|
||||
|
||||
|
||||
def assert_llm_equality(llm: LLM, loaded_llm: LLM) -> None:
|
||||
"""Assert LLM Equality for tests."""
|
||||
# Check that they are the same type.
|
||||
assert type(llm) == type(loaded_llm)
|
||||
# Client field can be session based, so hash is different despite
|
||||
# all other values being the same, so just assess all other fields
|
||||
for field in llm.__fields__.keys():
|
||||
if field != "client":
|
||||
val = getattr(llm, field)
|
||||
new_val = getattr(loaded_llm, field)
|
||||
assert new_val == val
|
Reference in New Issue
Block a user