load#

langchain_core.load.load.load(obj: Any, *, secrets_map: Dict[str, str] | None = None, valid_namespaces: List[str] | None = None, secrets_from_env: bool = True) Any[source]#

Beta

This feature is in beta. It is actively being worked on, so the API may change.

Revive a LangChain class from a JSON object. Use this if you already have a parsed JSON object, eg. from json.load or orjson.loads.

Parameters:
  • obj (Any) – The object to load.

  • secrets_map (Dict[str, str] | None) – A map of secrets to load. If a secret is not found in the map, it will be loaded from the environment if secrets_from_env is True. Defaults to None.

  • valid_namespaces (List[str] | None) – A list of additional namespaces (modules) to allow to be deserialized. Defaults to None.

  • secrets_from_env (bool) – Whether to load secrets from the environment. Defaults to True.

Returns:

Revived LangChain objects.

Return type:

Any

Examples using load