def import_argparse_to_params()

in GenAIFlow.py [0:0]


    def import_argparse_to_params(cls, parser):
        """
        Given an argument parser class using the standard python argparse library, construct
        similar Metaflow parameters for the flow that can be triggered in the Metaflow command line
        or a provider UI (Such as Outerbounds). Arguments are have arg_ prefix added to them in the
        metaflow UI.

        Multiple input arguments must be submitted as comma separated strings

        Supports most typical arguments and true flags (default if not set).
        """
        for action in parser._actions:
            if action.default != argparse.SUPPRESS:
                if is_true_flag_action(action):
                    setattr(cls, MF_ARG_PREFIX + action.dest, Parameter("arg_" + action.dest,
                                                                        type=bool,
                                                                        help=f"{action.help}",
                                                                        default=False))
                elif is_optional_int_value(action):
                    setattr(cls, MF_ARG_PREFIX + action.dest, Parameter("arg_" + action.dest,
                                                                        type=bool,
                                                                        help=f"{action.help}",
                                                                        default=False))
                elif action.nargs in ["*", "+"]:
                    setattr(cls, MF_ARG_MULTI_PREFIX + action.dest, Parameter("arg_" + action.dest,
                                                                    type=action.type or str,
                                                                    help=f"{action.help} {(','.join(action.choices)) if action.choices is not None else ''}",
                                                                    default=action.default))
                else:
                    setattr(cls, MF_ARG_PREFIX + action.dest, Parameter("arg_" + action.dest,
                                                                    type=action.type or str,
                                                                    help=f"{action.help} {(','.join(action.choices)) if action.choices is not None else ''}",
                                                                    default=action.default))