class_docstr: Client for interacting with the MLflow Gateway API.
  
  :param gateway_uri: Optional URI of the gateway. If not provided, attempts to resolve from
      first the stored result of `set_gateway_uri()`, then the  environment variable
      `MLFLOW_GATEWAY_URI`.
class_docstr_tok: ["Client","for","interacting","with","the","MLflow","Gateway","API",".",":","param","gateway_uri",":","Optional","URI","of","the","gateway",".","If","not","provided",",","attempts","to","resolve","from","first","the","stored","result","of","`","set_gateway_uri","(",")","`",",","then","the","environment","variable","`","MLFLOW_GATEWAY_URI","`","."]
docstr: Submit a query to a configured provider route.
  
  Args:
      route: The name of the route to submit the query to.
      data: The data to send in the query. A dictionary representing the per-route
          specific structure required for a given provider.
  
          For chat, the structure should be:
  
          .. code-block:: python
  
              from mlflow.gateway import MlflowGatewayClient
  
              gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
              response = gateway_client.query(
                  "my-chat-route",
                  {
                      "messages": [
                          {"role": "user", "content": "Tell me a joke about rabbits"},
                      ]
                  },
              )
  
          For completions, the structure should be:
  
          .. code-block:: python
  
              from mlflow.gateway import MlflowGatewayClient
  
              gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
              response = gateway_client.query(
                  "my-completions-route", {"prompt": "It's one small step for"}
              )
  
          For embeddings, the structure should be:
  
          .. code-block:: python
  
              from mlflow.gateway import MlflowGatewayClient
  
              gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
              response = gateway_client.query(
                  "my-embeddings-route",
                  {"text": ["It was the best of times", "It was the worst of times"]},
              )
  
          Additional parameters that are valid for a given provider and route configuration
          can be included with the request as shown below, using an openai completions route
          request as an example:
  
          .. code-block:: python
  
              from mlflow.gateway import MlflowGatewayClient
  
              gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
              response = gateway_client.query(
                  "my-completions-route",
                  {
                      "prompt": "Give me an example of a properly formatted pytest unit test",
                      "temperature": 0.3,
                      "max_tokens": 500,
                  },
              )
  
  Returns:
      The route's response as a dictionary, standardized to the route type.
docstr_tok: ["Submit","a","query","to","a","configured","provider","route",".","Args",":","route",":","The","name","of","the","route","to","submit","the","query","to",".","data",":","The","data","to","send","in","the","query",".","A","dictionary","representing","the","per-route","specific","structure","required","for","a","given","provider",".","For","chat",",","the","structure","should","be",":","..","code-block",":",":","python","from","mlflow.gateway","import","MlflowGatewayClient","gateway_client","=","MlflowGatewayClient","(","``","http",":","\/\/my.gateway:8888","''",")","response","=","gateway_client.query","(","``","my-chat-route","''",",","{","``","messages","''",":","[","{","``","role","''",":","``","user","''",",","``","content","''",":","``","Tell","me","a","joke","about","rabbits","''","}",",","]","}",",",")","For","completions",",","the","structure","should","be",":","..","code-block",":",":","python","from","mlflow.gateway","import","MlflowGatewayClient","gateway_client","=","MlflowGatewayClient","(","``","http",":","\/\/my.gateway:8888","''",")","response","=","gateway_client.query","(","``","my-completions-route","''",",","{","``","prompt","''",":","``","It","'s","one","small","step","for","''","}",")","For","embeddings",",","the","structure","should","be",":","..","code-block",":",":","python","from","mlflow.gateway","import","MlflowGatewayClient","gateway_client","=","MlflowGatewayClient","(","``","http",":","\/\/my.gateway:8888","''",")","response","=","gateway_client.query","(","``","my-embeddings-route","''",",","{","``","text","''",":","[","``","It","was","the","best","of","times","''",",","``","It","was","the","worst","of","times","''","]","}",",",")","Additional","parameters","that","are","valid","for","a","given","provider","and","route","configuration","can","be","included","with","the","request","as","shown","below",",","using","an","openai","completions","route","request","as","an","example",":","..","code-block",":",":","python","from","mlflow.gateway","import","MlflowGatewayClient","gateway_client","=","MlflowGatewayClient","(","``","http",":","\/\/my.gateway:8888","''",")","response","=","gateway_client.query","(","``","my-completions-route","''",",","{","``","prompt","''",":","``","Give","me","an","example","of","a","properly","formatted","pytest","unit","test","''",",","``","temperature","''",":","0.3",",","``","max_tokens","''",":","500",",","}",",",")","Returns",":","The","route","'s","response","as","a","dictionary",",","standardized","to","the","route","type","."]
code: def query(self, route: str, data: Dict[str, Any]):
      """
      Submit a query to a configured provider route.
  
      Args:
          route: The name of the route to submit the query to.
          data: The data to send in the query. A dictionary representing the per-route
              specific structure required for a given provider.
  
              For chat, the structure should be:
  
              .. code-block:: python
  
                  from mlflow.gateway import MlflowGatewayClient
  
                  gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
                  response = gateway_client.query(
                      "my-chat-route",
                      {
                          "messages": [
                              {"role": "user", "content": "Tell me a joke about rabbits"},
                          ]
                      },
                  )
  
              For completions, the structure should be:
  
              .. code-block:: python
  
                  from mlflow.gateway import MlflowGatewayClient
  
                  gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
                  response = gateway_client.query(
                      "my-completions-route", {"prompt": "It's one small step for"}
                  )
  
              For embeddings, the structure should be:
  
              .. code-block:: python
  
                  from mlflow.gateway import MlflowGatewayClient
  
                  gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
                  response = gateway_client.query(
                      "my-embeddings-route",
                      {"text": ["It was the best of times", "It was the worst of times"]},
                  )
  
              Additional parameters that are valid for a given provider and route configuration
              can be included with the request as shown below, using an openai completions route
              request as an example:
  
              .. code-block:: python
  
                  from mlflow.gateway import MlflowGatewayClient
  
                  gateway_client = MlflowGatewayClient("http://my.gateway:8888")
  
                  response = gateway_client.query(
                      "my-completions-route",
                      {
                          "prompt": "Give me an example of a properly formatted pytest unit test",
                          "temperature": 0.3,
                          "max_tokens": 500,
                      },
                  )
  
      Returns:
          The route's response as a dictionary, standardized to the route type.
  
      """
  
      data = json.dumps(data)
  
      query_route = assemble_uri_path(
          [MLFLOW_GATEWAY_ROUTE_BASE, route, MLFLOW_QUERY_SUFFIX]
      )
  
      try:
          return self._call_endpoint("POST", query_route, data).json()
      except MlflowException as e:
          if isinstance(e.__cause__, requests.exceptions.Timeout):
              timeout_message = (
                  "The provider has timed out while generating a response to your "
                  "query. Please evaluate the available parameters for the query "
                  "that you are submitting. Some parameter values and inputs can "
                  "increase the computation time beyond the allowable route "
                  f"timeout of {MLFLOW_GATEWAY_CLIENT_QUERY_TIMEOUT_SECONDS} "
                  "seconds."
              )
              raise MlflowException(
                  message=timeout_message, error_code=BAD_REQUEST
              )
          else:
              raise e
  
imports: import json
  import logging
  from typing import Any, Dict, List, Optional
  import requests.exceptions
  from mlflow import MlflowException
  from mlflow.gateway.config import LimitsConfig, Route
  from mlflow.gateway.constants import MLFLOW_GATEWAY_CLIENT_QUERY_RETRY_CODES, MLFLOW_GATEWAY_CLIENT_QUERY_TIMEOUT_SECONDS, MLFLOW_GATEWAY_CRUD_ROUTE_BASE, MLFLOW_GATEWAY_LIMITS_BASE, MLFLOW_GATEWAY_ROUTE_BASE, MLFLOW_QUERY_SUFFIX
  from mlflow.gateway.utils import assemble_uri_path, gateway_deprecated, get_gateway_uri, resolve_route_url
  from mlflow.protos.databricks_pb2 import BAD_REQUEST
  from mlflow.store.entities.paged_list import PagedList
  from mlflow.tracking._tracking_service.utils import _get_default_host_creds
  from mlflow.utils.databricks_utils import get_databricks_host_creds
  from mlflow.utils.rest_utils import augmented_raise_for_status, http_request
  from mlflow.utils.uri import get_uri_scheme
label_desc: Use image node_id 10 for calling the MlflowGatewayClient obj's underlying member method code with example usage: obj.query(route, data) and returns: self