code: def test_invalid_model_definition(tmp_path):
      invalid_partial_config = {
          "routes": [
              {
                  "name": "some_name",
                  "route_type": "llm/v1/completions",
                  "model": {
                      "name": "invalid",
                      "provider": "openai",
                      "config": {"openai_api_type": "openai"},
                  },
              }
          ]
      }
  
      conf_path = tmp_path.joinpath("config.yaml")
      conf_path.write_text(yaml.safe_dump(invalid_partial_config))
  
      with pytest.raises(
          MlflowException,
          match=re.compile(
              r"validation error.+openai_api_key", re.DOTALL
          ),
      ):
          _load_route_config(conf_path)
  
      invalid_format_config_key_is_not_string = {
          "routes": [
              {
                  "name": "some_name",
                  "route_type": "llm/v1/chat",
                  "model": {
                      "name": "invalid",
                      "provider": "openai",
                      "config": {
                          "openai_api_type": "openai",
                          "openai_api_key": [42],
                      },
                  },
              }
          ]
      }
  
      conf_path = tmp_path.joinpath("config.yaml")
      conf_path.write_text(
          yaml.safe_dump(invalid_format_config_key_is_not_string)
      )
  
      with pytest.raises(
          MlflowException,
          match="The api key provided is not a string",
      ):
          _load_route_config(conf_path)
  
      invalid_format_config_key_invalid_path = {
          "routes": [
              {
                  "name": "some_name",
                  "route_type": "llm/v1/embeddings",
                  "model": {
                      "name": "invalid",
                      "provider": "openai",
                      "config": {
                          "openai_api_type": "openai",
                          "openai_api_key": "/not/a/real/path",
                      },
                  },
              }
          ]
      }
  
      conf_path = tmp_path.joinpath("config.yaml")
      conf_path.write_text(
          yaml.safe_dump(invalid_format_config_key_invalid_path)
      )
  
      assert (
          _load_route_config(conf_path)
          .routes[0]
          .model.config.openai_api_key
          == "/not/a/real/path"
      )
  
      invalid_no_config = {
          "routes": [
              {
                  "name": "some_name",
                  "route_type": "llm/v1/embeddings",
                  "model": {
                      "name": "invalid",
                      "provider": "anthropic",
                  },
              }
          ]
      }
      conf_path = tmp_path.joinpath("config2.yaml")
      conf_path.write_text(yaml.safe_dump(invalid_no_config))
  
      with pytest.raises(
          MlflowException,
          match="A config must be supplied when setting a provider. The provider entry",
      ):
          _load_route_config(conf_path)
  
file_path: mlflow/tests/gateway/test_gateway_config_parsing.py
imports: import re
  import warnings
  import pytest
  import yaml
  from mlflow.exceptions import MlflowException
  from mlflow.gateway.config import AnthropicConfig, OpenAIConfig, RouteConfig, _load_route_config, _resolve_api_key_from_input, _save_route_config
  from mlflow.gateway.utils import assemble_uri_path
label_desc: Use image node_id 9 for calling a global function with example usage: test_invalid_model_definition(tmp_path) without return types