code: def get_model_kwargs(
      llamacpp_dict, default_kwargs, cls, exclude_list=[]
  ):
      # default from class
      model_kwargs = {
          k: v.default
          for k, v in dict(inspect.signature(cls).parameters).items()
          if k not in exclude_list
      }
      # from our defaults
      model_kwargs.update(default_kwargs)
      # from user defaults
      model_kwargs.update(llamacpp_dict)
      # ensure only valid keys
      func_names = list(inspect.signature(cls).parameters)
      model_kwargs = {
          k: v for k, v in model_kwargs.items() if k in func_names
      }
      # make int or float if can to satisfy types for class
      for k, v in model_kwargs.items():
          try:
              if float(v) == int(v):
                  model_kwargs[k] = int(v)
              else:
                  model_kwargs[k] = float(v)
          except:
              pass
      return model_kwargs
  
imports: import inspect
  import os
  from typing import Dict, Any, Optional, List, Iterator
  from langchain.callbacks.manager import CallbackManagerForLLMRun
  from langchain.schema.output import GenerationChunk
  from langchain.llms import gpt4all
  from pydantic.v1 import root_validator
  from utils import FakeTokenizer, url_alive, download_simple, clear_torch_cache, n_gpus_global
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
  from langchain.llms import LlamaCpp
label_desc: Use image node_id 2 for calling a global function with example usage: get_model_kwargs(llamacpp_dict, default_kwargs, cls, exclude_list) and returns: model_kwargs