mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 07:35:18 +00:00
core[patch]: exclude model cache from ser (#27086)
This commit is contained in:
parent
c09da53978
commit
87fc5ce688
@ -98,7 +98,7 @@ class BaseLanguageModel(
|
|||||||
All language model wrappers inherited from BaseLanguageModel.
|
All language model wrappers inherited from BaseLanguageModel.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cache: Union[BaseCache, bool, None] = None
|
cache: Union[BaseCache, bool, None] = Field(default=None, exclude=True)
|
||||||
"""Whether to cache the response.
|
"""Whether to cache the response.
|
||||||
|
|
||||||
* If true, will use the global cache.
|
* If true, will use the global cache.
|
||||||
|
@ -303,9 +303,7 @@ def test_llm_representation_for_serializable() -> None:
|
|||||||
chat = CustomChat(cache=cache, messages=iter([]))
|
chat = CustomChat(cache=cache, messages=iter([]))
|
||||||
assert chat._get_llm_string() == (
|
assert chat._get_llm_string() == (
|
||||||
'{"id": ["tests", "unit_tests", "language_models", "chat_models", '
|
'{"id": ["tests", "unit_tests", "language_models", "chat_models", '
|
||||||
'"test_cache", "CustomChat"], "kwargs": {"cache": {"id": ["tests", '
|
'"test_cache", "CustomChat"], "kwargs": {"messages": {"id": '
|
||||||
'"unit_tests", "language_models", "chat_models", "test_cache", '
|
|
||||||
'"InMemoryCache"], "lc": 1, "type": "not_implemented"}, "messages": {"id": '
|
|
||||||
'["builtins", "list_iterator"], "lc": 1, "type": "not_implemented"}}, "lc": '
|
'["builtins", "list_iterator"], "lc": 1, "type": "not_implemented"}}, "lc": '
|
||||||
'1, "name": "CustomChat", "type": "constructor"}---[(\'stop\', None)]'
|
'1, "name": "CustomChat", "type": "constructor"}---[(\'stop\', None)]'
|
||||||
)
|
)
|
||||||
@ -324,20 +322,6 @@ def test_cleanup_serialized() -> None:
|
|||||||
"CustomChat",
|
"CustomChat",
|
||||||
],
|
],
|
||||||
"kwargs": {
|
"kwargs": {
|
||||||
"cache": {
|
|
||||||
"lc": 1,
|
|
||||||
"type": "not_implemented",
|
|
||||||
"id": [
|
|
||||||
"tests",
|
|
||||||
"unit_tests",
|
|
||||||
"language_models",
|
|
||||||
"chat_models",
|
|
||||||
"test_cache",
|
|
||||||
"InMemoryCache",
|
|
||||||
],
|
|
||||||
"repr": "<tests.unit_tests.language_models.chat_models."
|
|
||||||
"test_cache.InMemoryCache object at 0x79ff437fe7d0>",
|
|
||||||
},
|
|
||||||
"messages": {
|
"messages": {
|
||||||
"lc": 1,
|
"lc": 1,
|
||||||
"type": "not_implemented",
|
"type": "not_implemented",
|
||||||
@ -380,18 +364,6 @@ def test_cleanup_serialized() -> None:
|
|||||||
"CustomChat",
|
"CustomChat",
|
||||||
],
|
],
|
||||||
"kwargs": {
|
"kwargs": {
|
||||||
"cache": {
|
|
||||||
"id": [
|
|
||||||
"tests",
|
|
||||||
"unit_tests",
|
|
||||||
"language_models",
|
|
||||||
"chat_models",
|
|
||||||
"test_cache",
|
|
||||||
"InMemoryCache",
|
|
||||||
],
|
|
||||||
"lc": 1,
|
|
||||||
"type": "not_implemented",
|
|
||||||
},
|
|
||||||
"messages": {
|
"messages": {
|
||||||
"id": ["builtins", "list_iterator"],
|
"id": ["builtins", "list_iterator"],
|
||||||
"lc": 1,
|
"lc": 1,
|
||||||
|
@ -101,7 +101,6 @@ def test_configurable() -> None:
|
|||||||
"name": None,
|
"name": None,
|
||||||
"bound": {
|
"bound": {
|
||||||
"name": None,
|
"name": None,
|
||||||
"cache": None,
|
|
||||||
"disable_streaming": False,
|
"disable_streaming": False,
|
||||||
"disabled_params": None,
|
"disabled_params": None,
|
||||||
"model_name": "gpt-4o",
|
"model_name": "gpt-4o",
|
||||||
@ -189,7 +188,6 @@ def test_configurable_with_default() -> None:
|
|||||||
"name": None,
|
"name": None,
|
||||||
"bound": {
|
"bound": {
|
||||||
"name": None,
|
"name": None,
|
||||||
"cache": None,
|
|
||||||
"disable_streaming": False,
|
"disable_streaming": False,
|
||||||
"model": "claude-3-sonnet-20240229",
|
"model": "claude-3-sonnet-20240229",
|
||||||
"max_tokens": 1024,
|
"max_tokens": 1024,
|
||||||
|
Loading…
Reference in New Issue
Block a user