loads#

langchain_core.load.load.loads(text: str, *, 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 string. Equivalent to load(json.loads(text)).

Parameters:
  • text (str) – The string 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 loads