deprecation.py — langchain Source File
Architecture documentation for deprecation.py, a python file in the langchain codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 94320bb6_6e56_d7f5_79eb_9674de780d72["deprecation.py"] 69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56["contextlib"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> 69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56 c990f2d7_9509_7cea_ca95_51ad57dbe5c6["functools"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> c990f2d7_9509_7cea_ca95_51ad57dbe5c6 614e7b9f_ed51_0780_749c_ff40b74963fc["inspect"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> 614e7b9f_ed51_0780_749c_ff40b74963fc 0c635125_6987_b8b3_7ff7_d60249aecde7["warnings"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> 0c635125_6987_b8b3_7ff7_d60249aecde7 cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 d37712e8_0aaa_0e67_fe9c_15ba87012437["pydantic.fields"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> d37712e8_0aaa_0e67_fe9c_15ba87012437 d3d2d1a3_179d_dab9_97d3_c1d2b37a3248["pydantic.v1.fields"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> d3d2d1a3_179d_dab9_97d3_c1d2b37a3248 088dc464_814e_9f9a_381f_17ac2cfb4263["langchain_core._api.internal"] 94320bb6_6e56_d7f5_79eb_9674de780d72 --> 088dc464_814e_9f9a_381f_17ac2cfb4263 style 94320bb6_6e56_d7f5_79eb_9674de780d72 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Helper functions for deprecating parts of the LangChain API.
This module was adapted from matplotlib's [`_api/deprecation.py`](https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/_api/deprecation.py)
module.
!!! warning
This module is for internal use only. Do not use it in your own code. We may change
the API at any time with no warning.
"""
import contextlib
import functools
import inspect
import warnings
from collections.abc import Callable, Generator
from typing import (
Any,
ParamSpec,
TypeVar,
cast,
)
from pydantic.fields import FieldInfo
from pydantic.v1.fields import FieldInfo as FieldInfoV1
from langchain_core._api.internal import is_caller_internal
def _build_deprecation_message(
*,
alternative: str = "",
alternative_import: str = "",
) -> str:
"""Build a simple deprecation message for `__deprecated__` attribute.
Args:
alternative: An alternative API name.
alternative_import: A fully qualified import path for the alternative.
Returns:
A deprecation message string for IDE/type checker display.
"""
if alternative_import:
return f"Use {alternative_import} instead."
if alternative:
return f"Use {alternative} instead."
return "Deprecated."
class LangChainDeprecationWarning(DeprecationWarning):
"""A class for issuing deprecation warnings for LangChain users."""
class LangChainPendingDeprecationWarning(PendingDeprecationWarning):
"""A class for issuing deprecation warnings for LangChain users."""
# PUBLIC API
// ... (544 more lines)
Domain
Subdomains
Functions
Dependencies
- collections.abc
- contextlib
- functools
- inspect
- langchain_core._api.internal
- pydantic.fields
- pydantic.v1.fields
- typing
- warnings
Source
Frequently Asked Questions
What does deprecation.py do?
deprecation.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in deprecation.py?
deprecation.py defines 7 function(s): _build_deprecation_message, _validate_deprecation_params, deprecated, rename_parameter, suppress_langchain_deprecation_warning, surface_langchain_deprecation_warnings, warn_deprecated.
What does deprecation.py depend on?
deprecation.py imports 9 module(s): collections.abc, contextlib, functools, inspect, langchain_core._api.internal, pydantic.fields, pydantic.v1.fields, typing, and 1 more.
Where is deprecation.py in the architecture?
deprecation.py is located at libs/core/langchain_core/_api/deprecation.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/core/langchain_core/_api).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free