code: def toxicity() -> EvaluationMetric:
      """
      This function will create a metric for evaluating `toxicity`_ using the model
      `roberta-hate-speech-dynabench-r4`_, which defines hate as "abusive speech targeting
      specific group characteristics, such as ethnic origin, religion, gender, or sexual
      orientation."
  
      The score ranges from 0 to 1, where scores closer to 1 are more toxic. The default threshold
      for a text to be considered "toxic" is 0.5.
  
      Aggregations calculated for this metric:
          - ratio (of toxic input texts)
  
      .. _toxicity: https://huggingface.co/spaces/evaluate-measurement/toxicity
      .. _roberta-hate-speech-dynabench-r4: https://huggingface.co/facebook/roberta-hate-speech-dynabench-r4-target
      """
      return make_metric(
          eval_fn=_toxicity_eval_fn,
          greater_is_better=False,
          name="toxicity",
          long_name="toxicity/roberta-hate-speech-dynabench-r4",
          version="v1",
      )
  
imports: from mlflow.metrics.base import MetricValue
  from mlflow.metrics.metric_definitions import _accuracy_eval_fn, _ari_eval_fn, _f1_score_eval_fn, _flesch_kincaid_eval_fn, _mae_eval_fn, _mape_eval_fn, _max_error_eval_fn, _mse_eval_fn, _ndcg_at_k_eval_fn, _precision_at_k_eval_fn, _precision_eval_fn, _r2_score_eval_fn, _recall_at_k_eval_fn, _recall_eval_fn, _rmse_eval_fn, _rouge1_eval_fn, _rouge2_eval_fn, _rougeL_eval_fn, _rougeLsum_eval_fn, _token_count_eval_fn, _toxicity_eval_fn
  from mlflow.models import EvaluationMetric, make_metric
  from mlflow.utils.annotations import experimental
label_desc: Use image node_id 3 for calling a global function with example usage: toxicity() and returns: make_metric