sms_agent / check_faiss.py
abrah926's picture
creating file
14a2007 verified
raw
history blame contribute delete
653 Bytes
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}")