# -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))

print("1. Starting...")
print(f"   CWD: {os.getcwd()}")

from dotenv import load_dotenv
load_dotenv()
print(f"2. API Key: {os.getenv('OPENAI_API_KEY', 'NOT SET')[:20]}...")

from utils.animal_rag import AnimalDrugRAG
print("3. Module imported")

rag = AnimalDrugRAG()
print("4. RAG created")

try:
    count = rag.index_md_files()
    print(f"5. Indexed: {count} chunks")
except Exception as e:
    print(f"5. Error: {e}")
    import traceback
    traceback.print_exc()

print("6. Done")
