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-core_apideprecationdeprecated
    Function●Since v0.1

    deprecated

    Copy
    deprecated(
      since: str,
      *,
      message: str = '',
      name: str
    View source on GitHub
    =
    ''
    ,
    alternative
    :
    str
    =
    ''
    ,
    alternative_import
    :
    str
    =
    ''
    ,
    pending
    :
    bool
    =
    False
    ,
    obj_type
    :
    str
    =
    ''
    ,
    addendum
    :
    str
    =
    ''
    ,
    removal
    :
    str
    =
    ''
    ,
    package
    :
    str
    =
    ''
    )
    ->
    Callable
    [
    [
    T
    ]
    ,
    T
    ]

    Parameters

    NameTypeDescription
    since*str

    The release at which this API became deprecated.

    messagestr
    Default:''

    Override the default deprecation message.

    The %(since)s, %(name)s, %(alternative)s, %(obj_type)s, %(addendum)s, and %(removal)s format specifiers will be replaced by the values of the respective arguments passed to this function.

    namestr
    Default:''

    The name of the deprecated object.

    alternativestr
    Default:''
    alternative_importstr
    Default:''
    pendingbool
    Default:False
    obj_typestr
    Default:''
    addendumstr
    Default:''
    removalstr
    Default:''
    packagestr
    Default:''

    Decorator to mark a function, a class, or a property as deprecated.

    When deprecating a classmethod, a staticmethod, or a property, the @deprecated decorator should go under @classmethod and @staticmethod (i.e., deprecated should directly decorate the underlying callable), but over @property.

    When deprecating a class C intended to be used as a base class in a multiple inheritance hierarchy, C must define an __init__ method (if C instead inherited its __init__ from its own base class, then @deprecated would mess up __init__ inheritance when installing its own (deprecation-emitting) C.__init__).

    Parameters are the same as for warn_deprecated, except that obj_type defaults to 'class' if decorating a class, 'attribute' if decorating a property, and 'function' otherwise.

    Example:

    @deprecated("1.4.0")
    def the_function_to_deprecate():
        pass

    An alternative API that the user may use in place of the deprecated API.

    The deprecation warning will tell the user about this alternative if provided.

    An alternative import that the user may use instead.

    If True, uses a PendingDeprecationWarning instead of a DeprecationWarning.

    Cannot be used together with removal.

    The object type being deprecated.

    Additional text appended directly to the final message.

    The expected removal version.

    With the default (an empty string), no removal version is shown in the warning message.

    Cannot be used together with pending.

    The package of the deprecated object.