#!/usr/bin/env python3 """ Test that all .lower() errors are fixed """ import os os.environ["ANTHROPIC_API_KEY"] = "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" from app import BasicAgent def test_with_problematic_questions(): """Test questions that might cause .lower() errors""" print("Testing GAIA agent with potentially problematic questions...") print("-" * 60) agent = BasicAgent() agent.set_api_key(os.environ["ANTHROPIC_API_KEY"]) test_questions = [ # Normal question "What is 2 + 2?", # Question that might trigger web search with connection issues "Who is the current president of France?", # Question with code that might return list "What is the output of: print([1,2,3])", # Image-related question "Look at the image and describe what you see", ] for i, question in enumerate(test_questions, 1): print(f"\nTest {i}: {question}") try: answer = agent(question) print(f"✅ Success: {answer[:100]}...") except AttributeError as e: if "lower" in str(e): print(f"❌ LOWER ERROR: {e}") else: print(f"❌ Other AttributeError: {e}") except Exception as e: print(f"❌ Other error ({type(e).__name__}): {e}") if __name__ == "__main__": print("=" * 80) print("Final Test - All .lower() errors should be fixed") print("=" * 80) test_with_problematic_questions() print("\n" + "=" * 80) print("If you see any 'lower' errors above, we missed a spot!") print("=" * 80)