Spaces:
Sleeping
Sleeping
| """ | |
| Test the intelligent routing system to show how the orchestrator makes decisions. | |
| """ | |
| import os | |
| import sys | |
| # Add parent directory to path for imports | |
| sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| from agent import answer_gaia_question | |
| def test_intelligent_routing(): | |
| """Test cases that demonstrate the orchestrator's decision-making capabilities.""" | |
| test_cases = [ | |
| { | |
| "question": "What is the capital of France?", | |
| "expected_behavior": "Direct answer (simple factual question)" | |
| }, | |
| { | |
| "question": "Calculate the sum of values in column A of the Excel file data.xlsx", | |
| "expected_behavior": "Route to retriever agent (file processing)" | |
| }, | |
| { | |
| "question": "What is the current CEO of OpenAI as of 2024?", | |
| "expected_behavior": "Route to research agent (current information)" | |
| }, | |
| { | |
| "question": "If a paper has a p-value of 0.04 and there were 1000 papers, how many would be false positives?", | |
| "expected_behavior": "Route to math agent (calculations)" | |
| }, | |
| { | |
| "question": "List the prime numbers between 1 and 20, comma-separated", | |
| "expected_behavior": "Route to math agent OR direct answer" | |
| } | |
| ] | |
| print("π§ Testing Intelligent Routing System") | |
| print("=" * 60) | |
| for i, test_case in enumerate(test_cases, 1): | |
| print(f"\nπ Test {i}: {test_case['question']}") | |
| print(f"π― Expected: {test_case['expected_behavior']}") | |
| print("-" * 40) | |
| try: | |
| # This will show the orchestrator's decision-making process | |
| print("π Processing...") | |
| answer = answer_gaia_question(test_case['question'], debug=True) | |
| print(f"β Final Result: {answer}") | |
| except Exception as e: | |
| print(f"β Error: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| print("-" * 60) | |
| if __name__ == "__main__": | |
| test_intelligent_routing() | |