code: def save_model(
      path,
      conda_env=None,
      code_paths=None,
      mlflow_model=None,
      signature=None,
      input_example=None,
      pip_requirements=None,
      prompt_template=None,
      prompt_parameters=None,
      model_parameters=None,
      model_route=None,
  ):
      from mlflow import pyfunc
      from mlflow.models import Model
      from mlflow.models.model import MLMODEL_FILE_NAME, Model
      from mlflow.models.utils import _save_example
      from mlflow.utils.environment import (
          _CONDA_ENV_FILE_NAME,
          _CONSTRAINTS_FILE_NAME,
          _PYTHON_ENV_FILE_NAME,
          _REQUIREMENTS_FILE_NAME,
          _process_conda_env,
          _process_pip_requirements,
          _PythonEnv,
          _validate_env_arguments,
          infer_pip_requirements,
      )
      from mlflow.utils.file_utils import write_to
      from mlflow.utils.model_utils import (
          _validate_and_copy_code_paths,
          _validate_and_prepare_target_save_path,
      )
  
      _validate_env_arguments(conda_env, pip_requirements, None)
  
      _validate_and_prepare_target_save_path(path)
      code_dir_subpath = _validate_and_copy_code_paths(code_paths, path)
  
      if mlflow_model is None:
          mlflow_model = Model()
      if signature is not None:
          mlflow_model.signature = signature
      if input_example is not None:
          _save_example(mlflow_model, input_example, path)
  
      parameters_sub_path = "parameters.yaml"
      parameters_path = os.path.join(path, parameters_sub_path)
      # dump prompt_template, prompt_parameters, model_parameters, model_route to parameters_path
  
      parameters = {
          "prompt_template": prompt_template,
          "prompt_parameters": {
              param.key: param.value for param in prompt_parameters
          },
          "model_parameters": {
              param.key: param.value for param in model_parameters
          },
          "model_route": model_route,
      }
      with open(parameters_path, "w") as f:
          yaml.safe_dump(parameters, stream=f, default_flow_style=False)
  
      pyfunc.add_to_model(
          mlflow_model,
          loader_module="mlflow.promptlab",
          parameters_path=parameters_sub_path,
          conda_env=_CONDA_ENV_FILE_NAME,
          python_env=_PYTHON_ENV_FILE_NAME,
          code=code_dir_subpath,
      )
  
      mlflow_model.save(os.path.join(path, MLMODEL_FILE_NAME))
  
      if conda_env is None:
          if pip_requirements is None:
              inferred_reqs = infer_pip_requirements(
                  path,
                  "mlflow._promptlab",
                  [f"mlflow[gateway]=={__version__}"],
              )
              default_reqs = sorted(inferred_reqs)
          else:
              default_reqs = None
          (
              conda_env,
              pip_requirements,
              pip_constraints,
          ) = _process_pip_requirements(
              default_reqs, pip_requirements, None
          )
      else:
          (
              conda_env,
              pip_requirements,
              pip_constraints,
          ) = _process_conda_env(conda_env)
  
      with open(os.path.join(path, _CONDA_ENV_FILE_NAME), "w") as f:
          yaml.safe_dump(conda_env, stream=f, default_flow_style=False)
  
      if pip_constraints:
          write_to(
              os.path.join(path, _CONSTRAINTS_FILE_NAME),
              "\n".join(pip_constraints),
          )
  
      write_to(
          os.path.join(path, _REQUIREMENTS_FILE_NAME),
          "\n".join(pip_requirements),
      )
  
      _PythonEnv.current().to_yaml(
          os.path.join(path, _PYTHON_ENV_FILE_NAME)
      )
  
file_path: mlflow/mlflow/promptlab/__init__.py
imports: import os
  import re
  from typing import List
  import yaml
  from mlflow.exceptions import MlflowException
  from mlflow.version import VERSION
label_desc: Use image node_id 2 for calling a global function with example usage: save_model(path, conda_env, code_paths, mlflow_model, signature, input_example, pip_requirements, prompt_template, prompt_parameters, model_parameters, model_route) without return types