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-coreutilspydantic
    Module●Since v0.1

    pydantic

    Utilities for pydantic.

    Attributes

    attribute
    PYDANTIC_VERSION
    attribute
    PYDANTIC_MAJOR_VERSION
    attribute
    PYDANTIC_MINOR_VERSION
    attribute
    IS_PYDANTIC_V1: bool
    attribute
    IS_PYDANTIC_V2: bool
    attribute
    PydanticBaseModel: BaseModel
    attribute
    TypeBaseModel: type[BaseModel]
    attribute
    TBaseModel
    attribute
    NO_DEFAULT

    Functions

    function
    is_pydantic_v1_subclass

    Check if the given class is Pydantic v1-like.

    function
    is_pydantic_v2_subclass

    Check if the given class is Pydantic v2-like.

    function
    is_basemodel_subclass

    Check if the given class is a subclass of Pydantic BaseModel.

    Check if the given class is a subclass of any of the following:

    • pydantic.BaseModel in Pydantic 2.x
    • pydantic.v1.BaseModel in Pydantic 2.x
    function
    is_basemodel_instance

    Check if the given class is an instance of Pydantic BaseModel.

    Check if the given class is an instance of any of the following:

    • pydantic.BaseModel in Pydantic 2.x
    • pydantic.v1.BaseModel in Pydantic 2.x
    function
    pre_init

    Decorator to run a function before model initialization.

    function
    get_fields

    Return the field names of a Pydantic model.

    function
    create_model

    Create a Pydantic model with the given field definitions.

    Please use create_model_v2 instead of this function.

    function
    create_model_v2

    Create a Pydantic model with the given field definitions.

    Warning

    Do not use outside of langchain packages. This API is subject to change at any time.

    deprecatedfunction
    get_pydantic_major_version

    DEPRECATED - Get the major version of Pydantic.

    Use PYDANTIC_VERSION.major instead.

    View source on GitHub