nemoguardrails.actions.action#
- nemoguardrails.actions.action(
- is_system_action=False,
- name=None,
- execute_async=False,
- output_mapping=None,
Decorator to mark a function or class as an action.
- Parameters:
is_system_action (bool) – Flag indicating if the action is a system action.
name (str) – The name to associate with the action.
execute_async (
bool) – Whether the function should be executed in async mode.output_mapping (Optional[Callable[[Any], bool]]) – A function to interpret the action’s result. It accepts the return value (e.g. the first element of a tuple) and return True if the output is not safe.
- Returns:
The decorated function or class.
- Return type:
callable