class_docstr: Model to extend to be able to call a batch endpoint
  expecting a list of ItemType as input.
class_docstr_tok: ["Model","to","extend","to","be","able","to","call","a","batch","endpoint","expecting","a","list","of","ItemType","as","input","."]
code: def _predict_batch(self, items, **kwargs):
      if not self.requests_session:
          self.requests_session = requests.Session()
      try:
          items = json.dumps(items)
      except TypeError:
          # TypeError: Object of type {ItemType} is not JSON serializable
          # Try converting a list of pydantic models to dict
          items = json.dumps([item.model_dump() for item in items])
      response = self.requests_session.post(
          self.endpoint,
          params=kwargs.get("endpoint_params", self.endpoint_params),
          data=items,
          headers={
              "content-type": "application/json",
              **kwargs.get("endpoint_headers", self.endpoint_headers),
          },
          timeout=self.timeout,
      )
      if response.status_code != 200:
          raise DistantHTTPModelError(
              response.status_code, response.reason, response.text
          )
      return response.json()
  
imports: import json
  from dataclasses import dataclass
  from typing import Callable, Optional
  import aiohttp
  import requests
  from structlog import get_logger
  from tenacity import retry, retry_if_exception, stop_after_attempt, wait_random_exponential
  from modelkit.core.model import AsyncModel, Model
  from modelkit.core.types import ItemType, ReturnType
label_desc: Use image node_id 3 for calling the DistantHTTPBatchModel obj's underlying member method code with example usage: obj._predict_batch(items) and returns: response