Create a self-documented recipe config to parametrize your recipe’s inputs
InputConfig
and defines the parameters your recipe expects in the same way as Pydantic models. Only the configuration classes that inherit from InputConfig
in your code get automatically transformed into UI widgets.
Above is an example of parameter selection in the UI for a config defined in the custom recipe as. You can set the description, title and default value for the resulting widget by using typing.Annotated
and pydantic.Field
as shown below.
When users run your recipe, by default they will only be forced to input the values for which you have not set defaults. This allows you to simplify the input interface to your recipe as much as possible, leaving the user only with the mandatory decision to be made, while also enabling the flexibility to change fine-grained parameters if needed.
Config parameters selection in the UI that map to the config above; the default learning_rate parameter is hidden, unless "Advanced parameters" is toggled.
@recipe_main
method (the input configuration must be the first parameter of the function, before the RecipeContext). When you run your recipe with input parameters, Adaptive Engine will create a typed and validated input object, and call @recipe_main
with an instantiated MyConfig
class.
max_value
, ge
etc.). There are also “magic” Adaptive types you can use in your config, which are platform-aware. This means that, when rendered in the UI, they allow you to select an entity that exists in your deployment as an input parameter - namely models, datasets and graders. If you pass one of these magic input parameters via SDK, it will also be validated for existence within your Adaptive deployment.
Below you will find examples usage of both basic python types and Adaptive magic classes.
model.path
(used to spawn the model), dataset.file
(used to load a dataset file) and grader.grader
(used to instantiate a grader).