mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-23 03:19:38 +00:00
fix: update method calls from dict to model_dump
in Chain
(#33035)
This commit is contained in:
@@ -750,11 +750,11 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
chain.dict(exclude_unset=True)
|
||||
chain.model_dump(exclude_unset=True)
|
||||
# -> {"_type": "foo", "verbose": False, ...}
|
||||
|
||||
"""
|
||||
_dict = super().dict(**kwargs)
|
||||
_dict = super().model_dump(**kwargs)
|
||||
with contextlib.suppress(NotImplementedError):
|
||||
_dict["_type"] = self._chain_type
|
||||
return _dict
|
||||
@@ -779,7 +779,7 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
|
||||
raise ValueError(msg)
|
||||
|
||||
# Fetch dictionary to save
|
||||
chain_dict = self.dict()
|
||||
chain_dict = self.model_dump()
|
||||
if "_type" not in chain_dict:
|
||||
msg = f"Chain {self} does not support saving."
|
||||
raise NotImplementedError(msg)
|
||||
|
Reference in New Issue
Block a user