# -*- coding: utf-8 -*-
import importlib
import utils.animal_rag as ar
importlib.reload(ar)

rag = ar.AnimalDrugRAG()
rag._init_db()

queries = ['구토 멈추는 약', '구토 치료제', '마로피턴트', '세레니아']

for q in queries:
    query_emb = rag._get_embedding(q)
    results = rag.table.search(query_emb).limit(5).to_list()
    
    print(f'\n🔍 "{q}"')
    for r in results:
        dist = r.get('_distance', 10)
        score = 1 / (1 + dist)
        source = r['source'][:40]
        section = r['section'][:25]
        print(f'  [{score:.0%}] {source} - {section}')
