code: import pandas as pd
  from omnivector.abstraction import AbstractDB
  
  class LanceDB(AbstractDB):
      """
      LanceDB is a vector database that uses Lance to store and search vectors.
      """
      def __init__(self):
          super().__init__()
  
      def create_index(self):
          # not sure how to do this in Lance
          pass
  
      def delete(self, ids):
          import lancedb
          db = lancedb.connect(self.config["lancedb"]["DB_PATH"])
  
          tbl = db.open_table("my_table")
          ids = ", ".join(str(v) for v in ids)
  
          tbl.delete(f"id IN ({ids})")
  
      def add(self, ids, vectors, metadata=None):
          import lancedb
          data = pd.DataFrame({"id": ids})
  
          db = lancedb.connect(self.config["lancedb"]["DB_PATH"])
  
          if metadata is not None:
              meta_df = pd.DataFrame.from_records(metadata)
              data = pd.concat([data, meta_df], axis=1)
  
          data["vector"] = vectors.tolist()
  
  
          try:
              tbl = db.open_table("my_table")
              tbl.add(data)
          except:
              db.create_table("my_table", data)
  
  
      def vector_search(self, vector, k=3):
          import lancedb
          db = lancedb.connect(self.config["lancedb"]["DB_PATH"])
  
          tbl = db.open_table("my_table")
  
          return tbl.search(vector).limit(k).to_df()
  
  
  
apis: lancedb.connect
extract_api: [((388, 438), 'lancedb.connect', 'lancedb.connect', (["self.config['lancedb']['DB_PATH']"], {}), "(self.config['lancedb']['DB_PATH'])\n", (403, 438), False, 'import lancedb\n'), ((650, 675), 'pandas.DataFrame', 'pd.DataFrame', (["{'id': ids}"], {}), "({'id': ids})\n", (662, 675), True, 'import pandas as pd\n'), ((690, 740), 'lancedb.connect', 'lancedb.connect', (["self.config['lancedb']['DB_PATH']"], {}), "(self.config['lancedb']['DB_PATH'])\n", (705, 740), False, 'import lancedb\n'), ((1157, 1207), 'lancedb.connect', 'lancedb.connect', (["self.config['lancedb']['DB_PATH']"], {}), "(self.config['lancedb']['DB_PATH'])\n", (1172, 1207), False, 'import lancedb\n'), ((797, 832), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['metadata'], {}), '(metadata)\n', (822, 832), True, 'import pandas as pd\n'), ((852, 886), 'pandas.concat', 'pd.concat', (['[data, meta_df]'], {'axis': '(1)'}), '([data, meta_df], axis=1)\n', (861, 886), True, 'import pandas as pd\n')]