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: Create a new route in the Gateway.
  
  .. warning::
  
      This API is **only available** when running within Databricks. When running elsewhere,
      route configuration is handled via updates to the route configuration YAML file that
      is specified during Gateway server start.
  
  Args:
      name: The name of the route. This parameter is required for all routes.
      route_type: The type of the route (e.g., 'llm/v1/chat', 'llm/v1/completions',
          'llm/v1/embeddings'). This parameter is required for routes that are not managed by
          Databricks (the provider isn't 'databricks').
      model: A dictionary representing the model details to be associated with the route.
          This parameter is required for all routes. This dictionary should define:
  
              - The model name (e.g., "gpt-3.5-turbo")
              - The provider (e.g., "openai", "anthropic")
              - The configuration for the model used in the route
  
  Returns:
      A serialized representation of the `Route` data structure,
      providing information about the name, type, and model details for the
      newly created route endpoint.
  
  Raises:
      mlflow.MlflowException: If the function is not running within Databricks.
  
  .. note::
  
      See the official Databricks documentation for MLflow Gateway for examples of supported
      model configurations and how to dynamically create new routes within Databricks.
  
  Example usage from within Databricks:
  
  .. code-block:: python
  
      from mlflow.gateway import MlflowGatewayClient
  
      gateway_client = MlflowGatewayClient("databricks")
  
      openai_api_key = ...
  
      new_route = gateway_client.create_route(
          name="my-route",
          route_type="llm/v1/completions",
          model={
              "name": "question-answering-bot",
              "provider": "openai",
              "openai_config": {
                  "openai_api_key": openai_api_key,
              },
          },
      )
docstr_tok: ["Create","a","new","route","in","the","Gateway",".","..","warning",":",":","This","API","is","*","*","only","available","*","*","when","running","within","Databricks",".","When","running","elsewhere",",","route","configuration","is","handled","via","updates","to","the","route","configuration","YAML","file","that","is","specified","during","Gateway","server","start",".","Args",":","name",":","The","name","of","the","route",".","This","parameter","is","required","for","all","routes",".","route_type",":","The","type","of","the","route","(","e.g.",",","'llm\/v1\/chat","'",",","'llm\/v1\/completions","'",",","'llm\/v1\/embeddings","'",")",".","This","parameter","is","required","for","routes","that","are","not","managed","by","Databricks","(","the","provider","is","n't","'databricks","'",")",".","model",":","A","dictionary","representing","the","model","details","to","be","associated","with","the","route",".","This","parameter","is","required","for","all","routes",".","This","dictionary","should","define",":","-","The","model","name","(","e.g.",",","``","gpt-3.5-turbo","''",")","-","The","provider","(","e.g.",",","``","openai","''",",","``","anthropic","''",")","-","The","configuration","for","the","model","used","in","the","route","Returns",":","A","serialized","representation","of","the","`","Route","`","data","structure",",","providing","information","about","the","name",",","type",",","and","model","details","for","the","newly","created","route","endpoint",".","Raises",":","mlflow.MlflowException",":","If","the","function","is","not","running","within","Databricks",".","..","note",":",":","See","the","official","Databricks","documentation","for","MLflow","Gateway","for","examples","of","supported","model","configurations","and","how","to","dynamically","create","new","routes","within","Databricks",".","Example","usage","from","within","Databricks",":","..","code-block",":",":","python","from","mlflow.gateway","import","MlflowGatewayClient","gateway_client","=","MlflowGatewayClient","(","``","databricks","''",")","openai_api_key","=","...","new_route","=","gateway_client.create_route","(","name=","''","my-route","''",",","route_type=","''","llm\/v1\/completions","''",",","model=","{","``","name","''",":","``","question-answering-bot","''",",","``","provider","''",":","``","openai","''",",","``","openai_config","''",":","{","``","openai_api_key","''",":","openai_api_key",",","}",",","}",",",")"]
code: def create_route(
      self,
      name: str,
      route_type: Optional[str] = None,
      model: Optional[Dict[str, Any]] = None,
  ) -> Route:
      """
      Create a new route in the Gateway.
  
      .. warning::
  
          This API is **only available** when running within Databricks. When running elsewhere,
          route configuration is handled via updates to the route configuration YAML file that
          is specified during Gateway server start.
  
      Args:
          name: The name of the route. This parameter is required for all routes.
          route_type: The type of the route (e.g., 'llm/v1/chat', 'llm/v1/completions',
              'llm/v1/embeddings'). This parameter is required for routes that are not managed by
              Databricks (the provider isn't 'databricks').
          model: A dictionary representing the model details to be associated with the route.
              This parameter is required for all routes. This dictionary should define:
  
                  - The model name (e.g., "gpt-3.5-turbo")
                  - The provider (e.g., "openai", "anthropic")
                  - The configuration for the model used in the route
  
      Returns:
          A serialized representation of the `Route` data structure,
          providing information about the name, type, and model details for the
          newly created route endpoint.
  
      Raises:
          mlflow.MlflowException: If the function is not running within Databricks.
  
      .. note::
  
          See the official Databricks documentation for MLflow Gateway for examples of supported
          model configurations and how to dynamically create new routes within Databricks.
  
      Example usage from within Databricks:
  
      .. code-block:: python
  
          from mlflow.gateway import MlflowGatewayClient
  
          gateway_client = MlflowGatewayClient("databricks")
  
          openai_api_key = ...
  
          new_route = gateway_client.create_route(
              name="my-route",
              route_type="llm/v1/completions",
              model={
                  "name": "question-answering-bot",
                  "provider": "openai",
                  "openai_config": {
                      "openai_api_key": openai_api_key,
                  },
              },
          )
      """
      if not self._is_databricks_host():
          raise MlflowException(
              "The create_route API is only available when running within "
              "Databricks. Route creation is handled through creating a "
              "configuration YAML file during startup or through updating a "
              "running Gateway server.",
              error_code=BAD_REQUEST,
          )
      payload = {
          "name": name,
          "route_type": route_type,
          "model": model,
      }
      response = self._call_endpoint(
          "POST", MLFLOW_GATEWAY_CRUD_ROUTE_BASE, json.dumps(payload)
      ).json()
      return Route(**response)
  
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 8 for calling the MlflowGatewayClient obj's underlying member method code with example usage: obj.create_route(name, route_type, model) and returns: Route