File size: 1,217 Bytes
e1624f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from rag_engine.retriever import OncoRAGRetriever
def main():
queries = [
"Patient with Stage III colon cancer, KRAS mutated",
"Paciente masculino de 65 a帽os con c谩ncer de colon en Estadio III, mutaci贸n KRAS",
"Tratamiento para glioblastoma recurrente en adultos mayores",
"How to treat a common cold with vitamin C",
"Melanoma metast谩sico con mutaci贸n BRAF V600E, progresi贸n tras ipilimumab",
"Receta para hacer una torta de chocolate",
"Non-small cell lung cancer stage IV with EGFR exon 19 deletion",
"Dolor de cabeza leve y fiebre baja en ni帽o de 8 a帽os"
]
retriever = OncoRAGRetriever()
for q in queries:
print(f"\n{'='*60}\nQuery: {q}")
candidates, distances = retriever._bi_encoder_retrieve(q, 5)
for i, (cand, dist) in enumerate(zip(candidates, distances)):
pass_gate = "PASS" if dist <= retriever.distance_threshold else "FAIL"
print(f" [{i}] Dist: {dist:.4f} [{pass_gate}] | Source: {cand['source']} - {cand['header']}")
if __name__ == '__main__':
main()
|