Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi All.
Editing my question to help better understand.
In a custom recipe or custom macro
We have the option to define a parameter as mandatory "mandatory":true
Can someone please help check if this option works properly for them in their custom recipe/macro.
i.e. a value for the parameter must be supplied in order to use the recipe/macro.
I am trying to check for v 8.0.5 and above.
Thanks
Testing this "required": true works for inputRoles/outputRoles.
However, for params using mandatory or required has no effect within recipe component. You could handle this in recipe code directly when reading the parameters here is an example of how this is done from another Plugin recipe
text_column_name = recipe_config.get('text_column_name', None)
if text_column_name is None:
raise ValueError("You did not choose a text column.")
n_sentences = recipe_config.get('n_sentences', None)
if n_sentences is None:
raise ValueError("You did not set a number of sentences.")
method = recipe_config.get('method', None)
if method is None:
raise ValueError("You did not choose a summarization method.")
Let me know if this helps.
Edited..
The "mandatory" flag does not apply to macros and it will only be used with other plugin components. We have captured this use case and the desire to make certain macro params/fields mandatory and is under review by our product team.
Thanks @AlexT
One Request, Just to help me out can you please check if the Mandatory option is working properly in other plugin components like a Component Recipe?
I faced an issue where it didnt work even on a custom recipe on V9
Testing this "required": true works for inputRoles/outputRoles.
However, for params using mandatory or required has no effect within recipe component. You could handle this in recipe code directly when reading the parameters here is an example of how this is done from another Plugin recipe
text_column_name = recipe_config.get('text_column_name', None)
if text_column_name is None:
raise ValueError("You did not choose a text column.")
n_sentences = recipe_config.get('n_sentences', None)
if n_sentences is None:
raise ValueError("You did not set a number of sentences.")
method = recipe_config.get('method', None)
if method is None:
raise ValueError("You did not choose a summarization method.")
Let me know if this helps.
Thanks @AlexT
With so many parameter examples and documents mentioning that option i somehow always assumed that it works.
We shall change all our codes to raise exceptions instead