code: def _save_runnable_with_steps(
      steps,
      file_path: Union[Path, str],
      loader_fn=None,
      persist_dir=None,
  ):
      """Save the model with steps. Currently it supports saving RunnableSequence and
      RunnableParallel.
  
      If saving a RunnableSequence, steps is a list of Runnable objects. We save each step to the
      subfolder named by the step index.
      e.g.  - model
              - steps
                - 0
                  - model.yaml
                - 1
                  - model.pkl
              - steps.yaml
      If saving a RunnableParallel, steps is a dictionary of key-Runnable pairs. We save each step to
      the subfolder named by the key.
      e.g.  - model
              - steps
                - context
                  - model.yaml
                - question
                  - model.pkl
              - steps.yaml
  
      We save steps.yaml file to the model folder. It contains each step's model's configuration.
  
      Args:
          steps: Steps of the runnable.
          file_path: Path to file to save the model to.
      """
      # Convert file to Path object.
      save_path = (
          Path(file_path) if isinstance(file_path, str) else file_path
      )
      save_path.mkdir(parents=True, exist_ok=True)
  
      # Save steps into a folder
      steps_path = save_path / _STEPS_FOLDER_NAME
      steps_path.mkdir()
  
      if isinstance(steps, list):
          generator = enumerate(steps)
      elif isinstance(steps, dict):
          generator = steps.items()
      unsaved_runnables = {}
      steps_conf = {}
      for key, runnable in generator:
          step = str(key)
          # Save each step into a subfolder named by step
          save_runnable_path = steps_path / step
          save_runnable_path.mkdir()
          if result := _save_internal_runnables(
              runnable, save_runnable_path, loader_fn, persist_dir
          ):
              steps_conf[step] = result
          else:
              unsaved_runnables[step] = str(runnable)
  
      if unsaved_runnables:
          raise MlflowException(
              f"Failed to save runnable sequence: {unsaved_runnables}. "
              "Runnable must have either `save` or `dict` method."
          )
  
      # save steps configs
      with save_path.joinpath(_RUNNABLE_STEPS_FILE_NAME).open("w") as f:
          yaml.dump(steps_conf, f, default_flow_style=False)
  
file_path: mlflow/mlflow/langchain/runnables.py
imports: import os
  from pathlib import Path
  from typing import Union
  import cloudpickle
  import yaml
  from mlflow.exceptions import MlflowException
  from mlflow.langchain.utils import _BASE_LOAD_KEY, _CONFIG_LOAD_KEY, _MODEL_DATA_FOLDER_NAME, _MODEL_DATA_KEY, _MODEL_DATA_PKL_FILE_NAME, _MODEL_DATA_YAML_FILE_NAME, _MODEL_LOAD_KEY, _MODEL_TYPE_KEY, _RUNNABLE_LOAD_KEY, _UNSUPPORTED_MODEL_ERROR_MESSAGE, _load_base_lcs, _load_from_json, _load_from_pickle, _load_from_yaml, _save_base_lcs, _validate_and_wrap_lc_model, base_lc_types, custom_type_to_loader_dict, lc_runnable_branch_type, lc_runnable_with_steps_types, lc_runnables_types, picklable_runnable_types
label_desc: Use image node_id 7 for calling a global function with example usage: _save_runnable_with_steps(steps, file_path, loader_fn, persist_dir) without return types