code: import lancedb
  import pyarrow as pa
  import pandas as pd
  import numpy as np
  import datetime
  from time import time, sleep
  from uuid import uuid4
  
  import tensorflow_hub as hub
  # Load the Universal Sentence Encoder
  encoder = hub.load('https://tfhub.dev/google/universal-sentence-encoder/4')
  
  def timestamp_to_datetime(unix_time):
      return datetime.datetime.fromtimestamp(unix_time).strftime("%A, %B %d, %Y at %I:%M%p %Z")
  
  initialization_data = {
      'unique_id': '2c9a93d5-3631-4faa-8eac-a99b92e45d50', 
      'vector': [-0.07254597, -0.00345811,  0.038447  ,  0.025837  , -0.01153462,
           0.05443505,  0.04415885, -0.03636164,  0.04025393,  0.07552634,
           0.05359982,  0.00822271, -0.01921194,  0.09719925, -0.05354664,
           0.06897003,  0.01113722,  0.06425729,  0.04223888, -0.05898998,
          -0.01620383,  0.01389384,  0.02873985, -0.00392985, -0.02874645,
           0.02680893, -0.01051578, -0.0792539 , -0.03293172, -0.00302758,
          -0.03745122, -0.02573149, -0.00473748, -0.04199643, -0.03275133,
           0.00779039,  0.00624639,  0.06108246, -0.03870484,  0.06269313,
          -0.06609031, -0.01554973, -0.04453023, -0.00073963,  0.01021871,
          -0.02984073,  0.00474442,  0.00195324, -0.02518238, -0.00426692,
           0.00750736,  0.10541135,  0.08878568,  0.05580394, -0.01232905,
          -0.04016594,  0.04829635, -0.05689557, -0.01863352,  0.03308525,
           0.06468356, -0.03367596,  0.03575945, -0.02212196, -0.01714826,
          -0.00585904, -0.09612011, -0.00102483,  0.06920582,  0.05855923,
          -0.04266937, -0.03763324, -0.02187943, -0.00141346, -0.086646  ,
           0.02106668,  0.00786448,  0.04093482, -0.00187637,  0.02952651,
          -0.03702659, -0.02844533,  0.00322303, -0.02380866, -0.05954637,
           0.07149482, -0.0065098 ,  0.06807149, -0.00099369,  0.05040864,
           0.04761266,  0.01862198, -0.05431763,  0.00940712, -0.00970824,
          -0.02216387,  0.024306  ,  0.03772607, -0.01540066,  0.03771403,
           0.01400787, -0.09354229, -0.06321603, -0.09549774,  0.00895245,
          -0.01175102,  0.03934404,  0.00956635, -0.04152715,  0.04295438,
           0.02825363,  0.02063269,  0.02212336, -0.06888197,  0.01428573,
           0.04887657,  0.00304061,  0.03196091,  0.03902192,  0.02360773,
          -0.02807535,  0.01558309,  0.02165642,  0.01129555,  0.0567826 ,
          -0.00659211, -0.01081236,  0.01809447,  0.00318123, -0.01214105,
          -0.05691559, -0.01717793,  0.05293235,  0.01663713,  0.04678147,
          -0.02094   , -0.05482098,  0.05463412,  0.00163532,  0.00956752,
          -0.03624124, -0.02359207,  0.01571903, -0.01502842,  0.03324307,
           0.01896691,  0.02235259,  0.02551061, -0.02953271,  0.05505196,
          -0.03115846, -0.01975026, -0.05484571, -0.01757487, -0.01038232,
          -0.06098176, -0.01663185, -0.06602633, -0.00643233,  0.00167366,
          -0.04243006,  0.01024193, -0.02288529, -0.06190364,  0.03787598,
           0.03914008, -0.04915332,  0.0182827 ,  0.0136188 ,  0.02917461,
           0.03118066, -0.03110682, -0.04193405, -0.01370175, -0.03901035,
           0.00850587,  0.01056607, -0.00084098, -0.01737773,  0.00836137,
           0.01500763,  0.00917414, -0.07946376,  0.02008886,  0.04600394,
           0.01271509, -0.01654603, -0.04405601,  0.01442427,  0.00967625,
           0.01212494,  0.01189141,  0.03507042, -0.00291006,  0.04226362,
          -0.0958102 ,  0.04722575, -0.02520623, -0.00780957, -0.01983704,
          -0.02350736, -0.03137485,  0.00325953,  0.10679087, -0.08251372,
           0.02922777, -0.05723861, -0.05683867, -0.04093323, -0.04769454,
          -0.02704669, -0.04450696,  0.03854201,  0.05599346, -0.07225747,
          -0.01060745, -0.01285277, -0.02004824,  0.00567907, -0.01130959,
           0.03845671, -0.06483931, -0.00013804,  0.00342195, -0.00497795,
           0.03194252,  0.06014316,  0.07774884, -0.02778566, -0.06470748,
           0.02103901,  0.02202238,  0.02044025,  0.10802107,  0.00356093,
          -0.01817842,  0.09661267, -0.05937773, -0.08208849, -0.05190327,
          -0.0302214 ,  0.05572621, -0.06395542, -0.03078226,  0.00083952,
           0.09572925, -0.04516173, -0.0123177 ,  0.09613901, -0.05666108,
          -0.00537586,  0.04220096,  0.00019196,  0.00295547, -0.07350546,
          -0.00707971, -0.01553643, -0.05214835,  0.00311794,  0.00742682,
          -0.02943217,  0.06675503,  0.04113274, -0.0809793 ,  0.03398148,
           0.01721729,  0.03014007, -0.04178908,  0.01025263,  0.03336379,
           0.05700357,  0.10388609,  0.00663307, -0.05146715, -0.02173147,
          -0.02297893, -0.01923811,  0.03292958,  0.0521661 ,  0.03923552,
           0.01330443,  0.02524009,  0.06507587, -0.01531762, -0.04601574,
           0.0499142 ,  0.06374968,  0.06080135, -0.08060206,  0.03382473,
          -0.03596291, -0.06714796, -0.08815136,  0.02092835,  0.10282409,
           0.07779143, -0.01839681, -0.03541641,  0.00666599,  0.0029895 ,
          -0.08307225, -0.06535257,  0.01114002, -0.06142527, -0.01779631,
           0.04441926,  0.02008377,  0.03211711, -0.02073815, -0.01346437,
           0.02578364, -0.01888524,  0.03310522, -0.02017466,  0.0198052 ,
          -0.01019527, -0.02200533, -0.02650121, -0.02987311, -0.04946938,
          -0.05915657, -0.0779579 ,  0.03368903,  0.01859711,  0.02692219,
           0.04209578, -0.01279042, -0.00151735, -0.03290961,  0.00719433,
          -0.05409581,  0.04818217, -0.00339916,  0.01444317, -0.04898094,
          -0.02065373, -0.04324449, -0.01409152, -0.02882394,  0.0129813 ,
          -0.03886433, -0.08824961,  0.02457459, -0.03383131,  0.04405662,
           0.03947931,  0.02983763,  0.00124698,  0.01098392,  0.05948395,
           0.08565806,  0.02848131, -0.00725272, -0.04415287, -0.03293212,
          -0.01364554, -0.09744117, -0.05662472,  0.03124948, -0.04624591,
          -0.00605065, -0.06229377,  0.08636316, -0.03645795,  0.08642905,
           0.03093746, -0.08031843,  0.01407037,  0.09892832,  0.03219265,
           0.02964027, -0.00517425, -0.03442131, -0.01141241, -0.06644958,
          -0.07285954,  0.00890575, -0.01360151,  0.00057073, -0.08988309,
           0.00797763,  0.0176619 ,  0.00745209, -0.07096376,  0.07894821,
          -0.08301938,  0.0990236 ,  0.03789177, -0.01905026,  0.0547296 ,
          -0.06224509,  0.01964617,  0.08179896, -0.0852924 ,  0.00475453,
          -0.01451678,  0.03582037, -0.04732088, -0.041508  ,  0.05553002,
          -0.00753875, -0.02849884,  0.04659286, -0.05146529, -0.0661836 ,
          -0.00761966,  0.01581906,  0.02444271, -0.01438573, -0.03466942,
          -0.06876651, -0.02311521, -0.00312491,  0.03457906, -0.04614082,
           0.03010868,  0.0206049 ,  0.08378315, -0.03001363, -0.00827654,
           0.01580172, -0.04855691,  0.00014473, -0.01702366,  0.06371997,
           0.00924862, -0.01441237,  0.0184262 ,  0.03586025,  0.07453281,
          -0.01822053,  0.00263505, -0.07093351, -0.02956585,  0.0937797 ,
          -0.03792839,  0.03657963, -0.01717029,  0.0077794 ,  0.06886019,
           0.04470135,  0.04228634,  0.06212147, -0.05456647, -0.02041842,
           0.02251387,  0.06653161, -0.00503211,  0.03463385, -0.02718318,
           0.00118317, -0.02953942, -0.04361469,  0.01001209,  0.01472133,
          -0.07398187,  0.00152049, -0.02058817, -0.03011479, -0.03247686,
          -0.03999605,  0.00089937,  0.06058171, -0.1016895 ,  0.07500667,
           0.03293885, -0.05828201, -0.01353116,  0.06867946, -0.03266895,
          -0.02314214,  0.03284731,  0.02857622,  0.05733896,  0.05395727,
           0.06677917, -0.01256167,  0.01832761,  0.01509516,  0.08785269,
          -0.01094873, -0.09930896, -0.00904166,  0.01920987,  0.01392063,
          -0.03855692,  0.04157091, -0.05284394,  0.01217607, -0.00495155,
          -0.02351189,  0.03753581,  0.03075539,  0.0635642 ,  0.05873286,
           0.00987345,  0.05255824, -0.08698288,  0.10400596, -0.00647114,
          -0.00831464,  0.0055213 ,  0.01613558, -0.10711982,  0.00563591,
           0.03591603,  0.00221161, -0.01541905, -0.0879847 , -0.05289326,
          -0.04107964, -0.04039652],
      'speaker': 'USER', 
      'time': 1695146425.0193892, 
      'message': 'this is a test.', 
      'timestring': 'Tuesday, September 19, 2023 at 02:00PM '
  }
  database_schema = pa.schema([
      pa.field("unique_id", pa.string()),
      pa.field("vector", pa.list_(pa.float32())),
      pa.field("speaker", pa.string()),
      pa.field("time", pa.float64()),
      pa.field("message", pa.string()),
      pa.field("timestring", pa.string()),
  ])
  
  vector_np = np.array( initialization_data[ "vector" ], dtype=np.float32 )
  # flattened_input = original_list.flatten().tolist()
  # original_list[ "vector" ] = flattened_input
  dataframe = pd.DataFrame([ initialization_data ])
  # arrow_table = pa.Table.from_pandas(dataframe, database_schema)
  
  hi_user_input = encoder([ "hi" ])
  
  initialization_data = {
      'unique_id': '2c9a93d5-3631-4faa-8eac-a99b92e45d50', 
      'vector': dataframe,
      'speaker': 'USER', 
      'time': 1695146425.0193892, 
      'message': 'this is a test.', 
      'timestring': 'Tuesday, September 19, 2023 at 02:00PM '
  }
  
  # Initialize lancedb
  lance_database = lancedb.connect("/tmp/fresh-lancedb")
  
  
  table_name = "lance-table" # Create the table with the defined schema
  if table_name in lance_database.table_names():
      print( "table %s already exists" % table_name )
      lance_database.drop_table(table_name)  # Drop the table if it already exists
      # lance_table = lance_database.create_table( table_name, schema=database_schema )
      dataframe = pd.DataFrame([ initialization_data ])
      arrow_table = pa.Table.from_pandas(dataframe, schema=database_schema )
      lance_table = lance_database.create_table( table_name, schema=database_schema, data=arrow_table )
  else:
      print( "creating table: %s" % table_name )
      # lance_table = lance_database.create_table( table_name, schema=database_schema )
      dataframe = pd.DataFrame([ initialization_data ])
      arrow_table = pa.Table.from_pandas(dataframe, schema=database_schema )
      lance_table = lance_database.create_table( table_name, schema=database_schema, data=arrow_table )
              
  uri = "/tmp/fresh-lancedb"
  lance_database = lancedb.connect(uri)
  
  # user_input = input('\n\nUSER: ')
  user_input = "hi"
  timestamp = time()
  timestring = timestamp_to_datetime(timestamp)
  unique_id = str(uuid4())       
  embedded_user_input = encoder([ user_input ]).numpy() # Convert the text into vector form
  # embedded_user_input = gpt3_embedding(ai_completion_text)
  unique_id = str(uuid4())
  speaker   = 'RAVEN'
  message = user_input 
  embedded_user_input = np.array( embedded_user_input )
  flattened_input = [float(item) for item in embedded_user_input.flatten().tolist()]
  
  result = lance_table.search( flattened_input ).limit(2).to_df()
  print( result )
  
  
  
  
  # stay open!!!!!!!!!!
  
  # table = lance_database.create_table("my_table",
  #                          data=[{"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
  #                                {"vector": [5.9, 26.5], "item": "bar", "price": 20.0}])
  # lance_table = lance_database.open_table( "lance-table" )
apis: lancedb.connect
extract_api: [((221, 286), 'tensorflow_hub.load', 'hub.load', (['"""https://tfhub.dev/google/universal-sentence-encoder/4"""'], {}), "('https://tfhub.dev/google/universal-sentence-encoder/4')\n", (229, 286), True, 'import tensorflow_hub as hub\n'), ((8432, 8489), 'numpy.array', 'np.array', (["initialization_data['vector']"], {'dtype': 'np.float32'}), "(initialization_data['vector'], dtype=np.float32)\n", (8440, 8489), True, 'import numpy as np\n'), ((8605, 8640), 'pandas.DataFrame', 'pd.DataFrame', (['[initialization_data]'], {}), '([initialization_data])\n', (8617, 8640), True, 'import pandas as pd\n'), ((9044, 9081), 'lancedb.connect', 'lancedb.connect', (['"""/tmp/fresh-lancedb"""'], {}), "('/tmp/fresh-lancedb')\n", (9059, 9081), False, 'import lancedb\n'), ((10078, 10098), 'lancedb.connect', 'lancedb.connect', (['uri'], {}), '(uri)\n', (10093, 10098), False, 'import lancedb\n'), ((10165, 10171), 'time.time', 'time', ([], {}), '()\n', (10169, 10171), False, 'from time import time, sleep\n'), ((10488, 10517), 'numpy.array', 'np.array', (['embedded_user_input'], {}), '(embedded_user_input)\n', (10496, 10517), True, 'import numpy as np\n'), ((9436, 9471), 'pandas.DataFrame', 'pd.DataFrame', (['[initialization_data]'], {}), '([initialization_data])\n', (9448, 9471), True, 'import pandas as pd\n'), ((9492, 9547), 'pyarrow.Table.from_pandas', 'pa.Table.from_pandas', (['dataframe'], {'schema': 'database_schema'}), '(dataframe, schema=database_schema)\n', (9512, 9547), True, 'import pyarrow as pa\n'), ((9806, 9841), 'pandas.DataFrame', 'pd.DataFrame', (['[initialization_data]'], {}), '([initialization_data])\n', (9818, 9841), True, 'import pandas as pd\n'), ((9862, 9917), 'pyarrow.Table.from_pandas', 'pa.Table.from_pandas', (['dataframe'], {'schema': 'database_schema'}), '(dataframe, schema=database_schema)\n', (9882, 9917), True, 'import pyarrow as pa\n'), ((10234, 10241), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (10239, 10241), False, 'from uuid import uuid4\n'), ((10415, 10422), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (10420, 10422), False, 'from uuid import uuid4\n'), ((337, 379), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['unix_time'], {}), '(unix_time)\n', (368, 379), False, 'import datetime\n'), ((8201, 8212), 'pyarrow.string', 'pa.string', ([], {}), '()\n', (8210, 8212), True, 'import pyarrow as pa\n'), ((8287, 8298), 'pyarrow.string', 'pa.string', ([], {}), '()\n', (8296, 8298), True, 'import pyarrow as pa\n'), ((8322, 8334), 'pyarrow.float64', 'pa.float64', ([], {}), '()\n', (8332, 8334), True, 'import pyarrow as pa\n'), ((8361, 8372), 'pyarrow.string', 'pa.string', ([], {}), '()\n', (8370, 8372), True, 'import pyarrow as pa\n'), ((8402, 8413), 'pyarrow.string', 'pa.string', ([], {}), '()\n', (8411, 8413), True, 'import pyarrow as pa\n'), ((8247, 8259), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (8257, 8259), True, 'import pyarrow as pa\n')]