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, additional_import_mappings: dict[tuple[str, ...], tuple[str, ...]] | None = None) 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.

  • additional_import_mappings (dict[tuple[str, ...], tuple[str, ...]] | None) – A dictionary of additional namespace mappings You can use this to override default mappings or add new mappings. Defaults to None.

Returns:

Revived LangChain objects.

Return type:

Any

Examples using load