File size: 1,054 Bytes
5e0532d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from datasets import load_dataset
import lancedb
import pandas as pd
import shutil

def inspect_and_verify():
    print("--- 1. Inspecting 'odunola/bible-reference-sentence-pair' ---")
    try:
        ds = load_dataset("odunola/bible-reference-sentence-pair", split="train", streaming=True)
        print("Success! First 3 examples:")
        count = 0
        for ex in ds:
            print(ex)
            count += 1
            if count >= 3:
                break
    except Exception as e:
        print(f"Failed to load dataset: {e}")

    print("\n--- 2. Verifying LanceDB ---")
    try:
        db = lancedb.connect("data/lancedb_test")
        df = pd.DataFrame({"vector": [[1.1, 1.2], [2.1, 2.2]], "item": ["foo", "bar"]})
        tbl = db.create_table("test_table", data=df, mode="overwrite")
        print(f"Created table. Count: {len(tbl)}")
        shutil.rmtree("data/lancedb_test")
        print("LanceDB verified.")
    except Exception as e:
        print(f"LanceDB failure: {e}")

if __name__ == "__main__":
    inspect_and_verify()