neuraltrain.utils.convert_to_pydantic¶
- neuraltrain.utils.convert_to_pydantic(class_to_convert: type, name: str, parent_class: Any = None, exclude_from_build: list[str] | None = None) BaseModel[source][source]¶
Converts any class into a pydantic BaseModel. Initialize the class with the ‘self.build()’ method
If parent_class inherits from exca.helpers.DiscriminatedModel, the name field is not added as it’s handled automatically by DiscriminatedModel.