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