File size: 1,742 Bytes
1637cd5 |
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#!/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) |