gemseo.utils.pydantic module#
Tools for Pydantic.
- create_model(Model, settings_model=None, **settings)[source]#
Create a Pydantic model.
- Parameters:
- Returns:
A Pydantic model
- Raises:
ValueError -- When the class of the
"settings"
argument is notModel
.- Return type:
T
- get_algo_name(settings_model, settings, *, class_name_arg='algo_name')#
Return the name of the class using settings defined as a Pydantic model.
- Parameters:
settings_model (BaseModel | None) -- The class settings as a Pydantic model. If
None
, use**settings
.settings (dict[str, Any]) -- The settings, including the class name (use the keyword
class_name_arg
). The function will remove theclass_name_arg
entry. These settings are ignored whensettings_model
is notNone
.class_name_arg (str) --
The name of the argument to set the class name.
By default it is set to "algo_name".
- Returns:
The class name.
- Return type:
- get_class_name(settings_model, settings, class_name_arg='algo_name')[source]#
Return the name of the class using settings defined as a Pydantic model.
- Parameters:
settings_model (BaseModel | None) -- The class settings as a Pydantic model. If
None
, use**settings
.settings (dict[str, Any]) -- The settings, including the class name (use the keyword
class_name_arg
). The function will remove theclass_name_arg
entry. These settings are ignored whensettings_model
is notNone
.class_name_arg (str) --
The name of the argument to set the class name.
By default it is set to "algo_name".
- Returns:
The class name.
- Return type: