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-coreloadvalidators
    Module●Since v1.2

    validators

    Init validators for deserialization security.

    This module contains extra validators that are called during deserialization, ex. to prevent security issues such as SSRF attacks.

    Each validator is a callable matching the InitValidator protocol: it takes a class path tuple and kwargs dict, returns None on success, and raises ValueError if the deserialization should be blocked.

    Attributes

    attribute
    InitValidator: Callable[[tuple[str, ...], dict[str, Any]], None]

    Type alias for a callable that validates kwargs during deserialization.

    The callable receives:

    • class_path: A tuple of strings identifying the class being instantiated (e.g., ('langchain', 'schema', 'messages', 'AIMessage')).
    • kwargs: The kwargs dict that will be passed to the constructor.

    The validator should raise an exception if the object should not be deserialized.

    attribute
    CLASS_INIT_VALIDATORS: dict[tuple[str, ...], InitValidator]
    View source on GitHub