code: def _prepare_messages(self, data):
      # numpy array is not json serializable, so we convert it to list
      # then send it to the model
      def _convert_ndarray_to_list(data):
          import numpy as np
  
          if isinstance(data, np.ndarray):
              return data.tolist()
          if isinstance(data, list):
              return [_convert_ndarray_to_list(d) for d in data]
          if isinstance(data, dict):
              return {
                  k: _convert_ndarray_to_list(v)
                  for k, v in data.items()
              }
          return data
  
      if isinstance(data, pd.DataFrame):
          return data.to_dict(orient="records")
  
      data = _convert_ndarray_to_list(data)
      if isinstance(self.lc_model, lc_runnables_types()):
          return [data]
      if isinstance(data, list) and (
          all(isinstance(d, str) for d in data)
          or all(isinstance(d, dict) for d in data)
      ):
          return data
      raise mlflow.MlflowException.invalid_parameter_value(
          "Input must be a pandas DataFrame or a list of strings "
          "or a list of dictionaries "
          f"for model {self.lc_model.__class__.__name__}"
      )
  
imports: import logging
  import os
  from typing import Any, Dict, List, Optional, Union
  import pandas
  import yaml
  import mlflow
  from mlflow import pyfunc
  from mlflow.environment_variables import _MLFLOW_TESTING
  from mlflow.langchain.runnables import _load_runnables, _save_runnables
  from mlflow.langchain.utils import _BASE_LOAD_KEY, _MODEL_LOAD_KEY, _RUNNABLE_LOAD_KEY, _load_base_lcs, _save_base_lcs, _validate_and_wrap_lc_model, lc_runnables_types
  from mlflow.models import Model, ModelInputExample, ModelSignature
  from mlflow.models.model import MLMODEL_FILE_NAME
  from mlflow.models.signature import _infer_signature_from_input_example
  from mlflow.models.utils import _save_example
  from mlflow.tracking._model_registry import DEFAULT_AWAIT_MAX_SLEEP_SECONDS
  from mlflow.tracking.artifact_utils import _download_artifact_from_uri
  from mlflow.types.schema import ColSpec, DataType, Schema
  from mlflow.utils.annotations import experimental
  from mlflow.utils.docstring_utils import LOG_MODEL_PARAM_DOCS, format_docstring
  from mlflow.utils.environment import _CONDA_ENV_FILE_NAME, _CONSTRAINTS_FILE_NAME, _PYTHON_ENV_FILE_NAME, _REQUIREMENTS_FILE_NAME, _mlflow_conda_env, _process_conda_env, _process_pip_requirements, _PythonEnv, _validate_env_arguments
  from mlflow.utils.file_utils import get_total_file_size, write_to
  from mlflow.utils.model_utils import _add_code_from_conf_to_system_path, _get_flavor_configuration, _validate_and_copy_code_paths, _validate_and_prepare_target_save_path
  from mlflow.utils.requirements_utils import _get_pinned_requirement
label_desc: Use image node_id 4 for calling the _LangChainModelWrapper obj's underlying member method code with example usage: obj._prepare_messages(data) and returns: data, data, list, data, data, unknown, unknown