#!/usr/bin/env python3 """ Test script to demonstrate the enhanced QA system with interview-style question handling. This script tests both regular questions and interview-style questions to show the difference. """ import os import sys from dotenv import load_dotenv # Add the current directory to Python path sys.path.append(os.path.dirname(os.path.abspath(__file__))) from queryrun import FAISSQuerySystem def test_questions(): """Test various types of questions to demonstrate the DeepSeek-enhanced system""" # Load environment variables load_dotenv() # Test questions test_cases = [ { "type": "General Question", "question": "What is Julien's educational background?" }, { "type": "Interview Question", "question": "Tell me about a challenging project you worked on and how you overcame the difficulties." }, { "type": "Technical Question", "question": "What programming languages does Julien know?" }, { "type": "Experience Question", "question": "Describe your experience with machine learning and what excites you most about AI research." }, { "type": "Research Question", "question": "What are Julien's research interests?" }, { "type": "Personal Question", "question": "Walk me through your journey in computer science and what motivated you to pursue this field." } ] try: print("Initializing RAG system...") query_system = FAISSQuerySystem() print("RAG system ready!\n") for i, test_case in enumerate(test_cases, 1): print(f"{'='*80}") print(f"TEST CASE {i}: {test_case['type']}") print(f"Question: {test_case['question']}") print(f"{'='*80}") # Search for relevant documents print("\nSearching for relevant documents...") docs = query_system.search(test_case['question'], k=5) print(f"Found {len(docs)} relevant documents") # Generate response using DeepSeek (with Cohere fallback) print("\nGenerating response with DeepSeek...") response = query_system.generate_hybrid_response(test_case['question'], docs) print(f"\nResponse:") print("-" * 60) print(response) print("-" * 60) # Show sources if docs: print(f"\nSources used:") for j, doc in enumerate(docs[:3], 1): # Show top 3 sources print(f" {j}. {doc['metadata'].get('source', 'Unknown')} (score: {doc['score']:.4f})") print(f"\n{'-'*80}\n") except Exception as e: print(f"Error during testing: {e}") import traceback traceback.print_exc() if __name__ == "__main__": test_questions()