MedSpace / scripts /verify_local_kb.py
kbsss's picture
Upload folder using huggingface_hub
4325034 verified
Raw
History Blame Contribute Delete
799 Bytes
import chromadb
from chromadb.config import Settings
import sys
import os
KB_PATH = "data/knowledge_base"
if not os.path.exists(KB_PATH):
print(f"❌ Path not found: {KB_PATH}")
sys.exit(1)
try:
print(f"πŸ“‚ Checking {KB_PATH}...")
client = chromadb.PersistentClient(path=KB_PATH)
col = client.get_collection("medical_knowledge")
count = col.count()
print(f"βœ… Collection found: {col.name}")
print(f"πŸ“Š Documents: {count}")
if count == 0:
print("❌ Collection is EMPTY!")
sys.exit(1)
# Check if vectors exist
res = col.peek()
if not res['embeddings']:
print("❌ No embeddings found!")
else:
print("βœ… Embeddings present.")
except Exception as e:
print(f"❌ Error: {e}")
sys.exit(1)