File size: 653 Bytes
14a2007
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import faiss

index_path = "my_embeddings"  # Adjust if saved elsewhere

try:
    index = faiss.read_index(index_path)
    print(f"πŸ“Š FAISS index contains {index.ntotal} vectors.")
    
    # βœ… Check embedding dimensions
    d = index.d
    print(f"βœ… Embedding dimension: {d}")
    
    # βœ… Retrieve and print a few embeddings
    if index.ntotal > 0:
        vectors = index.reconstruct_n(0, min(5, index.ntotal))  # Get first 5 embeddings
        print(f"🧐 Sample embeddings: {vectors}")
    else:
        print("⚠️ No embeddings found in FAISS index!")

except Exception as e:
    print(f"❌ ERROR: Failed to load FAISS index - {e}")