LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coreloadloadReviver
    Class●Since v0.1

    Reviver

    Copy
    Reviver(
      self,
      allowed_objects: Iterable[AllowedObject] | Literal['all', 'core']

    Constructors

    Attributes

    View source on GitHub
    =
    'core'
    ,
    secrets_map
    :
    dict
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    valid_namespaces
    :
    list
    [
    str
    ]
    |
    None
    =
    None
    ,
    secrets_from_env
    :
    bool
    =
    False
    ,
    additional_import_mappings
    :
    dict
    [
    tuple
    [
    str
    ,
    .
    .
    .
    ]
    ,
    tuple
    [
    str
    ,
    .
    .
    .
    ]
    ]
    |
    None
    =
    None
    ,
    *
    ,
    ignore_unserializable_fields
    :
    bool
    =
    False
    ,
    init_validator
    :
    InitValidator
    |
    None
    =
    default_init_validator
    )

    Parameters

    NameTypeDescription
    allowed_objectsIterable[AllowedObject] | Literal['all', 'core']
    Default:'core'

    Allowlist of classes that can be deserialized.

    • 'core' (default): Allow classes defined in the serialization mappings for langchain_core.

    • 'all': Allow classes defined in the serialization mappings.

      This includes core LangChain types (messages, prompts, documents, etc.) and trusted partner integrations. See langchain_core.load.mapping for the full list.

    • Explicit list of classes: Only those specific classes are allowed.

    secrets_mapdict[str, str] | None
    Default:None
    valid_namespaceslist[str] | None
    Default:None
    secrets_from_envbool
    Default:False
    additional_import_mappingsdict[tuple[str, ...], tuple[str, ...]] | None
    Default:None
    ignore_unserializable_fieldsbool
    Default:False
    init_validatorInitValidator | None
    Default:default_init_validator
    constructor
    __init__
    NameType
    allowed_objectsIterable[AllowedObject] | Literal['all', 'core']
    secrets_mapdict[str, str] | None
    valid_namespaceslist[str] | None
    secrets_from_envbool
    additional_import_mappingsdict[tuple[str, ...], tuple[str, ...]] | None
    ignore_unserializable_fieldsbool
    init_validatorInitValidator | None
    attribute
    secrets_from_env: secrets_from_env
    attribute
    secrets_map
    attribute
    valid_namespaces: list
    attribute
    additional_import_mappings
    attribute
    import_mappings: dict
    attribute
    allowed_class_paths: set[tuple[str, ...]] | None
    attribute
    ignore_unserializable_fields: ignore_unserializable_fields
    attribute
    init_validator: init_validator

    Reviver for JSON objects.

    Used as the object_hook for json.loads to reconstruct LangChain objects from their serialized JSON representation.

    Only classes in the allowlist can be instantiated.

    A map of secrets to load.

    Only include the specific secrets the serialized object requires. If a secret is not found in the map, it will be loaded from the environment if secrets_from_env is True.

    Additional namespaces (modules) to allow during deserialization, beyond the default trusted namespaces.

    Whether to load secrets from the environment.

    A crafted payload can name arbitrary environment variables in its secret fields, so enabling this on untrusted data can leak sensitive values. Keep this False (the default) unless the serialized data is fully trusted.

    A dictionary of additional namespace mappings.

    You can use this to override default mappings or add new mappings.

    When allowed_objects is None (using defaults), paths from these mappings are also added to the allowed class paths.

    Whether to ignore unserializable fields.

    Optional callable to validate kwargs before instantiation.

    If provided, this function is called with (class_path, kwargs) where class_path is the class path tuple and kwargs is the kwargs dict. The validator should raise an exception if the object should not be deserialized, otherwise return None.

    Defaults to default_init_validator which blocks jinja2 templates.