Utilities for pydantic.
Check if the given class is Pydantic v1-like.
Check if the given class is Pydantic v2-like.
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.xpydantic.v1.BaseModel in Pydantic 2.xCheck 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.xpydantic.v1.BaseModel in Pydantic 2.xDecorator to run a function before model initialization.
Return the field names of a Pydantic model.
Return the JSON schema of a Pydantic model class of either major version.
Dispatches to the correct method for Pydantic v1 (schema) or v2
(model_json_schema), so callers holding a TypeBaseModel don't have to
branch on the model's version themselves.
Validate obj against a Pydantic model class of either major version.
Dispatches to the correct method for Pydantic v1 (parse_obj) or v2
(model_validate), so callers holding a TypeBaseModel don't have to
branch on the model's version themselves.
Create a Pydantic model with the given field definitions.
Please use create_model_v2 instead of this function.
Create a Pydantic model with the given field definitions.
Do not use outside of langchain packages. This API is subject to change at any time.
DEPRECATED - Get the major version of Pydantic.
Use PYDANTIC_VERSION.major instead.