| 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}") | |