Netflix / metaflow

Open Source Platform for developing, scaling and deploying serious ML, AI, and data science systems
https://metaflow.org
Apache License 2.0
8.24k stars 774 forks source link

Add support for Parameters of type enum #2117

Open svpino opened 2 weeks ago

svpino commented 2 weeks ago

It'd be great if we had support for enum parameters.

Here is how we would define a Parameter today:

action = Parameter(
        "action",
        help="The action you want to perform. Supported values are 'traffic' and 'labeling'.",
        default="traffic"
    )

Notice how we need to rely on documentation to let the user know which values are supported. We also need to validate as part of the flow that the supplied value is supported.

Instead, it would be great to do something like this:

action = Parameter(
        "action",
        help="The action you want to perform.",
        type="enum",
        values=["traffic", "labeling"],
        default="traffic"
)

Metaflow could automatically validate the value of the parameter and we won't have to do that as part of the flow.

savingoyal commented 2 weeks ago

that's a neat proposal. we will discuss internally and get back to you!