code: def test_make_genai_metric_incorrect_response():
      custom_metric = make_genai_metric(
          name="correctness",
          version="v1",
          definition=example_definition,
          grading_prompt=example_grading_prompt,
          examples=[mlflow_example],
          model="gateway:/gpt-3.5-turbo",
          grading_context_columns=["targets"],
          parameters={"temperature": 0.0},
          greater_is_better=True,
          aggregations=["mean", "variance", "p90"],
      )
  
      with mock.patch.object(
          model_utils,
          "score_model_on_payload",
          return_value=incorrectly_formatted_openai_response,
      ):
          metric_value = custom_metric.eval_fn(
              pd.Series([mlflow_prediction]),
              {},
              pd.Series(["What is MLflow?"]),
              pd.Series([mlflow_ground_truth]),
          )
  
      assert metric_value.scores == [None]
      assert metric_value.justifications == [
          f"Failed to extract score and justification. Raw output:"
          f" {incorrectly_formatted_openai_response}"
      ]
  
      assert np.isnan(metric_value.aggregate_results["mean"])
      assert np.isnan(metric_value.aggregate_results["variance"])
      assert metric_value.aggregate_results["p90"] is None
  
      with mock.patch.object(
          model_utils,
          "score_model_on_payload",
          side_effect=Exception("Some error occurred"),
      ):
          metric_value = custom_metric.eval_fn(
              pd.Series([mlflow_prediction]),
              {},
              pd.Series(["What is MLflow?"]),
              pd.Series([mlflow_ground_truth]),
          )
  
      assert metric_value.scores == [None]
      assert metric_value.justifications == [
          "Failed to score model on payload. Error: Some error occurred"
      ]
  
      assert np.isnan(metric_value.aggregate_results["mean"])
      assert np.isnan(metric_value.aggregate_results["variance"])
      assert metric_value.aggregate_results["p90"] is None
  
imports: import inspect
  import re
  from unittest import mock
  import numpy
  import pandas
  import pytest
  from mlflow.exceptions import MlflowException
  from mlflow.metrics.genai import EvaluationExample, model_utils
  from mlflow.metrics.genai.genai_metric import _extract_score_and_justification, _format_args_string, make_genai_metric
  from mlflow.metrics.genai.metric_definitions import answer_correctness, answer_relevance, answer_similarity, faithfulness, relevance
  from mlflow.metrics.genai.prompts.v1 import AnswerCorrectnessMetric, AnswerRelevanceMetric, AnswerSimilarityMetric, FaithfulnessMetric, RelevanceMetric
label_desc: Use image node_id 3 for calling a global function with example usage: test_make_genai_metric_incorrect_response() without return types