code: def _infer_artifact_type_and_ext(
      artifact_name, raw_artifact, custom_metric_tuple
  ):
      """
      This function performs type and file extension inference on the provided artifact
      :param artifact_name: The name of the provided artifact
      :param raw_artifact: The artifact object
      :param custom_metric_tuple: Containing a user provided function and its index in the
                                  ``custom_metrics`` parameter of ``mlflow.evaluate``
      :return: InferredArtifactProperties namedtuple
      """
  
      exception_header = (
          f"Custom metric function '{custom_metric_tuple.name}' at index "
          f"{custom_metric_tuple.index} in the `custom_metrics` parameter produced an "
          f"artifact '{artifact_name}'"
      )
  
      # Given a string, first see if it is a path. Otherwise, check if it is a JsonEvaluationArtifact
      if isinstance(raw_artifact, str):
          potential_path = pathlib.Path(raw_artifact)
          if potential_path.exists():
              raw_artifact = potential_path
          else:
              try:
                  json.loads(raw_artifact)
                  return _InferredArtifactProperties(
                      from_path=False,
                      type=JsonEvaluationArtifact,
                      ext=".json",
                  )
              except JSONDecodeError:
                  raise MlflowException(
                      f"{exception_header} with string representation '{raw_artifact}' that is "
                      f"neither a valid path to a file nor a JSON string."
                  )
  
      # Type inference based on the file extension
      if isinstance(raw_artifact, pathlib.Path):
          if not raw_artifact.exists():
              raise MlflowException(
                  f"{exception_header} with path '{raw_artifact}' does not exist."
              )
          if not raw_artifact.is_file():
              raise MlflowException(
                  f"{exception_header} with path '{raw_artifact}' is not a file."
              )
          if raw_artifact.suffix not in _EXT_TO_ARTIFACT_MAP:
              raise MlflowException(
                  f"{exception_header} with path '{raw_artifact}' does not match any of the supported"
                  f" file extensions: {', '.join(_EXT_TO_ARTIFACT_MAP.keys())}."
              )
          return _InferredArtifactProperties(
              from_path=True,
              type=_EXT_TO_ARTIFACT_MAP[raw_artifact.suffix],
              ext=raw_artifact.suffix,
          )
  
      # Type inference based on object type
      if type(raw_artifact) in _TYPE_TO_ARTIFACT_MAP:
          return _InferredArtifactProperties(
              from_path=False,
              type=_TYPE_TO_ARTIFACT_MAP[type(raw_artifact)],
              ext=_TYPE_TO_EXT_MAP[type(raw_artifact)],
          )
  
      # Given as other python object, we first attempt to infer as JsonEvaluationArtifact. If that
      # fails, we store it as PickleEvaluationArtifact
      try:
          json.dumps(raw_artifact, cls=NumpyEncoder)
          return _InferredArtifactProperties(
              from_path=False, type=JsonEvaluationArtifact, ext=".json"
          )
      except TypeError:
          return _InferredArtifactProperties(
              from_path=False,
              type=PickleEvaluationArtifact,
              ext=".pickle",
          )
  
imports: import json
  import pathlib
  import pickle
  from collections import namedtuple
  from json import JSONDecodeError
  import matplotlib.pyplot
  import numpy
  import pandas
  from mlflow.exceptions import MlflowException
  from mlflow.models.evaluation.base import EvaluationArtifact
  from mlflow.utils.annotations import developer_stable
  from mlflow.utils.proto_json_utils import NumpyEncoder
label_desc: Use image node_id 1 for calling a global function with example usage: _infer_artifact_type_and_ext(artifact_name, raw_artifact, custom_metric_tuple) and returns: _InferredArtifactProperties, _InferredArtifactProperties, _InferredArtifactProperties, _InferredArtifactProperties, _InferredArtifactProperties