ISSUE: Not able to log CustomLLM using mlflow.pyfunc.log_model
Labels: name: auto:bug, name: area: models

### System Info

LangChain version: 0.0.316

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```python

from langchain.llms.base import LLM

class CustomLLM(LLM):
    endpoint_name: str
    token: str

    @property
    def _llm_type(self) -> str:
        return "custom"

    def _score_model(self, dataset, temperature = 0.75, max_new_tokens = 100):
      url = f'https://XXXXXXXXXXX/{self.endpoint_name}/XXXXXX'
      headers = {'Authorization': f'Bearer {self.token}', 'Content-Type': 'application/json'}
      temp_dict = {'index': [0], 'columns': ['prompt', 'temperature', 'max_new_tokens'], 'data': [[dataset, temperature, max_new_tokens]]}
      data_json = json.dumps({'dataframe_split': temp_dict}, allow_nan=True)
      response = requests.request(method='POST', headers=headers, url=url, data=data_json)
      return response.json()['predictions']['candidates'][0]

    def _call(self, prompt: str, stop: Optional[List[str]] = None, 
              run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any):
        if stop is not None: raise ValueError("stop kwargs are not permitted.")
        return self._score_model(prompt)
        
    @property
    def _identifying_params(self) -> Mapping[str, Any]:
        """Get the identifying parameters."""
        return {"endpoint_name": self.endpoint_name, "token":self.token}


class MLflowQABot(mlflow.pyfunc.PythonModel):
  def __init__(self, llm, retriever, chat_prompt):
   # QABot class just call the custom LLM class and customize the output 
    self.qabot = QABot(llm, retriever, chat_prompt)

  def predict(self, context, inputs):
    questions = list(inputs['question'])
    return [self.qabot.get_answer(q) for q in questions]

system_message_prompt = SystemMessagePromptTemplate.from_template(config['system_message_template'])
human_message_prompt = HumanMessagePromptTemplate.from_template(config['human_message_template'])
chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt])

# Working fine: mean able to log model when I change LLM to ChatOpenAI
# llm = ChatOpenAI(model_name=config['openai_chat_model'], temperature=config['temperature'])
llm = CustomLLM("llama2-7b", token)
model = MLflowQABot(llm, retriever, chat_prompt)

input_columns = [{"type": "string", "name": input_key} for input_key in qa_chain.input_keys]
with mlflow.start_run() as run:
  mlflow_result = mlflow.pyfunc.log_model(
      python_model           = model,
      extra_pip_requirements = ['langchain', 'tiktoken', 'openai', 
                              'faiss-gpu', 'typing-inspect', 'typing_extensions'],
      artifact_path          = 'model',
      #registered_model_name=config['registered_model_name'],
      signature              = infer_signature(input_columns, "This is prediction"))
```

### Expected behavior

### This is expected result.
``` python
(1) MLflow run
Logged [1 run](XXXXXb7d8e14c08964c988339b7c8a7) to an [experiment](XXXXXX80369415271497) in MLflow. [Learn more](https://docs.microsoft.com/azure/databricks/applications/mlflow/tracking#tracking-machine-learning-training-runs)
```
### But getting this error:
```python
---------------------------------------------------------------------------
PicklingError                             Traceback (most recent call last)
File <command-1869824020018208>, line 3
      1 # persist model to mlflow
      2 with mlflow.start_run() as run:
----> 3   mlflow_result = mlflow.pyfunc.log_model(
      4       python_model           = model,
      5       extra_pip_requirements = ['langchain', 'tiktoken', 'openai', 
      6                               'faiss-gpu', 'typing-inspect', 'typing_extensions'],
      7       artifact_path          = 'model',
      8       #registered_model_name=config['registered_model_name'],
      9       signature              = signature)

File /databricks/python/lib/python3.10/site-packages/mlflow/pyfunc/__init__.py:1931, in log_model(artifact_path, loader_module, data_path, code_path, conda_env, python_model, artifacts, registered_model_name, signature, input_example, await_registration_for, pip_requirements, extra_pip_requirements, metadata)
   1773 @format_docstring(LOG_MODEL_PARAM_DOCS.format(package_name="scikit-learn"))
   1774 def log_model(
   1775     artifact_path,
   (...)
   1788     metadata=None,
   1789 ):
   1790     """
   1791     Log a Pyfunc model with custom inference logic and optional data dependencies as an MLflow
   1792     artifact for the current run.
   (...)
   1929              metadata of the logged model.
   1930     """
-> 1931     return Model.log(
   1932         artifact_path=artifact_path,
   1933         flavor=mlflow.pyfunc,
   1934         loader_module=loader_module,
   1935         data_path=data_path,
   1936         code_path=code_path,
   1937         python_model=python_model,
   1938         artifacts=artifacts,
   1939         conda_env=conda_env,
   1940         registered_model_name=registered_model_name,
   1941         signature=signature,
   1942         input_example=input_example,
   1943         await_registration_for=await_registration_for,
   1944         pip_requirements=pip_requirements,
   1945         extra_pip_requirements=extra_pip_requirements,
   1946         metadata=metadata,
   1947     )

File /databricks/python/lib/python3.10/site-packages/mlflow/models/model.py:572, in Model.log(cls, artifact_path, flavor, registered_model_name, await_registration_for, metadata, **kwargs)
    566 if (
    567     (tracking_uri == "databricks" or get_uri_scheme(tracking_uri) == "databricks")
    568     and kwargs.get("signature") is None
    569     and kwargs.get("input_example") is None
    570 ):
    571     _logger.warning(_LOG_MODEL_MISSING_SIGNATURE_WARNING)
--> 572 flavor.save_model(path=local_path, mlflow_model=mlflow_model, **kwargs)
    573 mlflow.tracking.fluent.log_artifacts(local_path, mlflow_model.artifact_path)
    574 try:

File /databricks/python/lib/python3.10/site-packages/mlflow/pyfunc/__init__.py:1759, in save_model(path, loader_module, data_path, code_path, conda_env, mlflow_model, python_model, artifacts, signature, input_example, pip_requirements, extra_pip_requirements, metadata, **kwargs)
   1748     return _save_model_with_loader_module_and_data_path(
   1749         path=path,
   1750         loader_module=loader_module,
   (...)
   1756         extra_pip_requirements=extra_pip_requirements,
   1757     )
   1758 elif second_argument_set_specified:
-> 1759     return mlflow.pyfunc.model._save_model_with_class_artifacts_params(
   1760         path=path,
   1761         signature=signature,
   1762         hints=hints,
   1763         python_model=python_model,
   1764         artifacts=artifacts,
   1765         conda_env=conda_env,
   1766         code_paths=code_path,
   1767         mlflow_model=mlflow_model,
   1768         pip_requirements=pip_requirements,
   1769         extra_pip_requirements=extra_pip_requirements,
   1770     )

File /databricks/python/lib/python3.10/site-packages/mlflow/pyfunc/model.py:189, in _save_model_with_class_artifacts_params(path, python_model, signature, hints, artifacts, conda_env, code_paths, mlflow_model, pip_requirements, extra_pip_requirements)
    187 saved_python_model_subpath = "python_model.pkl"
    188 with open(os.path.join(path, saved_python_model_subpath), "wb") as out:
--> 189     cloudpickle.dump(python_model, out)
    190 custom_model_config_kwargs[CONFIG_KEY_PYTHON_MODEL] = saved_python_model_subpath
    192 if artifacts:

File /databricks/python/lib/python3.10/site-packages/cloudpickle/cloudpickle_fast.py:57, in dump(obj, file, protocol, buffer_callback)
     45 def dump(obj, file, protocol=None, buffer_callback=None):
     46     """Serialize obj as bytes streamed into file
     47 
     48     protocol defaults to cloudpickle.DEFAULT_PROTOCOL which is an alias to
   (...)
     53     compatibility with older versions of Python.
     54     """
     55     CloudPickler(
     56         file, protocol=protocol, buffer_callback=buffer_callback
---> 57     ).dump(obj)

File /databricks/python/lib/python3.10/site-packages/cloudpickle/cloudpickle_fast.py:602, in CloudPickler.dump(self, obj)
    600 def dump(self, obj):
    601     try:
--> 602         return Pickler.dump(self, obj)
    603     except RuntimeError as e:
    604         if "recursion" in e.args[0]:

PicklingError: Can't pickle <cyfunction bool_validator at 0x7f95076a4450>: it's not the same object as pydantic.validators.bool_validator
```