create_model_v2#
- langchain_core.utils.pydantic.create_model_v2(model_name: str, *, module_name: str | None = None, field_definitions: dict[str, Any] | None = None, root: Any | None = None) type[BaseModel] [source]#
Create a pydantic model with the given field definitions.
Attention
Please do not use outside of langchain packages. This API is subject to change at any time.
- Parameters:
model_name (str) – The name of the model.
module_name (str | None) – The name of the module where the model is defined. This is used by Pydantic to resolve any forward references.
field_definitions (dict[str, Any] | None) – The field definitions for the model.
root (Any | None) – Type for a root model (RootModel)
- Returns:
The created model.
- Return type:
Type[BaseModel]