code: def _make_model_endpoint_fn(self, model, item_type):
      if isinstance(model, AsyncModel):
  
          async def _aendpoint(
              item: item_type = fastapi.Body(...),
              model=fastapi.Depends(
                  lambda: self.lib.get(model.configuration_key)
              ),
          ):
              return await model.predict(item)
  
          return _aendpoint
  
      def _endpoint(
          item: item_type = fastapi.Body(...),
          model=fastapi.Depends(
              lambda: self.lib.get(model.configuration_key)
          ),
      ):
          return model.predict(item)
  
      return _endpoint
  
file_path: modelkit/modelkit/api.py
imports: import os
  from typing import Any, Dict, List, Optional, Union
  import fastapi
  from rich.console import Console
  from structlog import get_logger
  from modelkit.core.errors import ModelsNotFound
  from modelkit.core.library import LibrarySettings, ModelConfiguration, ModelLibrary
  from modelkit.core.model import AbstractModel, AsyncModel
  from modelkit.core.types import LibraryModelsType
label_desc: Use image node_id 2 for calling the ModelkitAutoAPIRouter obj's underlying member method code with example usage: obj._make_model_endpoint_fn(model, item_type) and returns: _endpoint, _aendpoint, model, unknown