mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 23:29:21 +00:00
added ability to override default verbose and memory when load chain … (#1153)
It is useful to be able to specify `verbose` or `memory` while still keeping the chain's overall structure. --------- Co-authored-by: Francisco Ingham <>
This commit is contained in:
parent
d2ef5d6167
commit
0b6a650cb4
@ -463,5 +463,12 @@ def _load_chain_from_file(file: Union[str, Path], **kwargs: Any) -> Chain:
|
||||
config = yaml.safe_load(f)
|
||||
else:
|
||||
raise ValueError("File type must be json or yaml")
|
||||
|
||||
# Override default 'verbose' and 'memory' for the chain
|
||||
if "verbose" in kwargs:
|
||||
config["verbose"] = kwargs.pop("verbose")
|
||||
if "memory" in kwargs:
|
||||
config["memory"] = kwargs.pop("memory")
|
||||
|
||||
# Load the chain from the config now.
|
||||
return load_chain_from_config(config, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user