pydantic_copy() — langchain Function Reference
Architecture documentation for the pydantic_copy() function in _compat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 215cfce1_e136_f082_932b_222f632c4797["pydantic_copy()"] 75bf479b_1332_0b5c_5710_656c22821d19["_compat.py"] 215cfce1_e136_f082_932b_222f632c4797 -->|defined in| 75bf479b_1332_0b5c_5710_656c22821d19 style 215cfce1_e136_f082_932b_222f632c4797 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tracers/_compat.py lines 83–95
def pydantic_copy(obj: T, **kwargs: Any) -> T:
"""Copy any Pydantic model, compatible with both v1 and v2.
Args:
obj: The Pydantic model to copy.
**kwargs: Additional arguments passed to `model_copy`/`copy`.
Returns:
A copy of the model.
"""
if _RUN_IS_PYDANTIC_V2:
return obj.model_copy(**kwargs) # type: ignore[attr-defined,no-any-return]
return obj.copy(**kwargs) # type: ignore[attr-defined,no-any-return]
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does pydantic_copy() do?
pydantic_copy() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/_compat.py.
Where is pydantic_copy() defined?
pydantic_copy() is defined in libs/core/langchain_core/tracers/_compat.py at line 83.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free