code: # load_pdf.py - Loads PDF documents into the LanceDB vector store
  
  ## Imports:
  from langchain.embeddings import OpenAIEmbeddings
  from langchain.text_splitter import CharacterTextSplitter
  from langchain.vectorstores import LanceDB
  import dotenv
  import lancedb
  import os
  from pypdf import PdfReader
  
  ## Set Env Variables
  dotenv.load_dotenv()
  if None == os.environ.get('OPENAI_API_KEY'):
      raise ValueError("Env OPENAI_API_KEY not set")
  else:
      OAI_TOKEN = os.environ.get('OPENAI_API_KEY')
  
  filename = "./backend/utilities/NAME_OF_PDF.pdf"
  
  ## Set up connection to OpenAI
  embeddings = OpenAIEmbeddings()
  
  ## Set up knowledge VectorStore
  db_name = "./helios_kb.db"
  table_name = "helios_kb"
  db = lancedb.connect(db_name)
  if table_name not in db.table_names():
      table = db.create_table(
          "helios_kb",
          data=[
              {
                  "vector": embeddings.embed_query("You are Helios, an AI chatbot that can perform background research tasks."),
                  "text": "You are Helios, an AI chatbot that can perform background research tasks with access to the internet.",
                  "id": "1",
              }
          ],
          mode="create",
      )
  else:
      table = db.open_table(table_name)
  vectorstore = LanceDB(connection=table, embedding=embeddings)
  
  ## Load and split PDF file
  reader = PdfReader(filename)
  parts = []
  
  def visitor_body(text, cm, tm, font_dict, font_size):
      y = cm[5]
      if y > 50 and y < 720:
          parts.append(text)
  
  page_id = 0
  for page in reader.pages:
      print("Loading Page " + str(page_id) + "...")
      text = page.extract_text(visitor_text=visitor_body)
      text_splitter = CharacterTextSplitter(        
          separator = "\n\n",
          chunk_size = 2500,
          chunk_overlap  = 250,
          length_function = len,
          is_separator_regex = False,
      )
      docs = text_splitter.create_documents([text])
      for doc in docs:
          vectorstore.add_texts(texts=[text], metadatas=[{"filename": filename, "page_number": page_id}])
      page_id += 1
apis: lancedb.connect
extract_api: [((319, 339), 'dotenv.load_dotenv', 'dotenv.load_dotenv', ([], {}), '()\n', (337, 339), False, 'import dotenv\n'), ((586, 604), 'langchain.embeddings.OpenAIEmbeddings', 'OpenAIEmbeddings', ([], {}), '()\n', (602, 604), False, 'from langchain.embeddings import OpenAIEmbeddings\n'), ((695, 719), 'lancedb.connect', 'lancedb.connect', (['db_name'], {}), '(db_name)\n', (710, 719), False, 'import lancedb\n'), ((1233, 1280), 'langchain.vectorstores.LanceDB', 'LanceDB', ([], {'connection': 'table', 'embedding': 'embeddings'}), '(connection=table, embedding=embeddings)\n', (1240, 1280), False, 'from langchain.vectorstores import LanceDB\n'), ((1318, 1337), 'pypdf.PdfReader', 'PdfReader', (['filename'], {}), '(filename)\n', (1327, 1337), False, 'from pypdf import PdfReader\n'), ((351, 383), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (365, 383), False, 'import os\n'), ((458, 490), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (472, 490), False, 'import os\n'), ((1637, 1763), 'langchain.text_splitter.CharacterTextSplitter', 'CharacterTextSplitter', ([], {'separator': '"""\n\n"""', 'chunk_size': '(2500)', 'chunk_overlap': '(250)', 'length_function': 'len', 'is_separator_regex': '(False)'}), "(separator='\\n\\n', chunk_size=2500, chunk_overlap=250,\n    length_function=len, is_separator_regex=False)\n", (1658, 1763), False, 'from langchain.text_splitter import CharacterTextSplitter\n')]