File size: 1,363 Bytes
2abc50d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python
# /Users/yagoairm2/Desktop/agents/final project/HF_Agents_Final_Project/test_question.py
"""
Script to test GAIA agent with a single question
Usage:
    python test_question.py "Your question here"
"""

import sys
import json
import logging
from app2 import GAIAAgent  # Import the agent from app2.py

# Configure logging
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s',
    handlers=[logging.StreamHandler()]
)
logger = logging.getLogger(__name__)

def main():
    """Run the agent on a single question from command line"""
    if len(sys.argv) < 2:
        print("Usage: python test_question.py \"Your question here\"")
        return
    
    # Get question from command line
    question = sys.argv[1]
    print(f"\n=== Testing GAIA Agent with question ===\n{question}\n")
    
    # Initialize agent
    try:
        agent = GAIAAgent()
        print("\n=== Agent initialized successfully ===\n")
    except Exception as e:
        print(f"\n!!! Error initializing agent: {e}")
        return
    
    # Run agent on question
    try:
        print("\n=== Running agent... ===\n")
        answer = agent(question)
        print(f"\n=== Agent response ===\n{answer}\n")
    except Exception as e:
        print(f"\n!!! Error running agent: {e}")

if __name__ == "__main__":
    main()