docs: def pdf_preprocess(pdf, batch=False):
      """
      Load pdfs from local filepath if not already b64 encoded
      """
      if batch:
          return [pdf_preprocess(doc, batch=False) for doc in pdf]
  
      if os.path.isfile(pdf):
          # a filepath is provided, read and encode
          return b64encode(open(pdf, 'rb').read())
      else:
          # assume pdf is already b64 encoded
          return pdf