code: def _call_deployments_api(deployment_uri, payload, eval_parameters):
      from mlflow.deployments import get_deploy_client
  
      client = get_deploy_client()
  
      endpoint = client.get_endpoint(deployment_uri)
      endpoint_type = endpoint.get(
          "task", endpoint.get("endpoint_type")
      )
  
      if endpoint_type == "llm/v1/completions":
          completions_payload = {
              "prompt": payload,
              **eval_parameters,
          }
          response = client.predict(
              endpoint=deployment_uri, inputs=completions_payload
          )
          return _parse_completions_response_format(response)
      elif endpoint_type == "llm/v1/chat":
          chat_payload = {
              "messages": [{"role": "user", "content": payload}],
              **eval_parameters,
          }
          response = client.predict(
              endpoint=deployment_uri, inputs=chat_payload
          )
          return _parse_chat_response_format(response)
  
      else:
          raise MlflowException(
              f"Unsupported endpoint type: {endpoint_type}. Use an "
              "endpoint of type 'llm/v1/completions' or 'llm/v1/chat' instead.",
              error_code=INVALID_PARAMETER_VALUE,
          )
  
file_path: mlflow/mlflow/metrics/genai/model_utils.py
imports: import logging
  import os
  import urllib.parse
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
  from mlflow.utils.openai_utils import REQUEST_URL_CHAT
label_desc: Use image node_id 4 for calling a global function with example usage: _call_deployments_api(deployment_uri, payload, eval_parameters) and returns: _parse_completions_response_format, _parse_chat_response_format