smart-models/Placebo_AI
0
1import sys2import os3sys.path.append(os.path.dirname(os.path.dirname(__file__)))4 5from src.chatbot_engine import MedicalChatbot6 7def test_pure_retrieval():8 print("Connecting to Chroma DB (bypassing Llama 3 generation to save memory)...")9 try:10 bot = MedicalChatbot()11 except Exception as e:12 print(f"Failed to initialize chatbot: {e}")13 return14 15 question = "What are the key clinical symptoms of acute appendicitis?"16 print(f"\nSearching Database for: '{question}'\n")17 18 try:19 # Bypass the LLM generation and just test the Vector Retriever directly!20 docs = bot.custom_retriever.get_relevant_documents_with_filter(question)21 print("====== RETRIEVAL RESULTS ======")22 for i, doc in enumerate(docs):23 book = doc.metadata.get('book_name', 'Unknown')24 page = doc.metadata.get('page_number', 'N/A')25 subject = doc.metadata.get('subject', 'General')26 print(f"\n[Result {i+1}] Book: {book} | Page: {page} | Subject: {subject}")27 print(f"Snippet: {doc.page_content[:400].strip()}...")28 except Exception as e:29 print(f"Failed to retrieve documents: {e}")30 31if __name__ == "__main__":32 test_pure_retrieval()33 