#!/usr/bin/env python3 """ Base Agent class for GAIA benchmark """ from abc import ABC, abstractmethod from typing import Dict, Any, Optional class BaseAgent(ABC): """Abstract base class for GAIA agents""" def __init__(self): """Initialize the agent""" pass @abstractmethod def __call__(self, question: str, task_id: Optional[str] = None) -> str: """ Process a question and return an answer Args: question: The question text task_id: Optional task ID for file downloads Returns: The answer as a string """ pass def classify_question(self, question: str) -> str: """ Classify the type of question Args: question: The question text Returns: Question type as string """ question_lower = question.lower() if any(word in question_lower for word in ['image', 'picture', 'chess', 'position']): return 'visual' elif any(word in question_lower for word in ['calculate', 'compute', 'math', 'number', 'how many', 'at bats', 'walks']): return 'computational' elif any(word in question_lower for word in ['country', 'location', 'where', 'geographical', 'olympics']): return 'geographical' elif any(word in question_lower for word in ['when', 'date', 'year', 'time']): return 'temporal' elif any(word in question_lower for word in ['reverse', 'backwards', '.rewsna']): return 'text_processing' elif any(word in question_lower for word in ['audio', 'recording', 'mp3', 'voice', 'listen']): return 'audio' elif any(word in question_lower for word in ['excel', 'file', 'table', 'data']): return 'data_analysis' else: return 'factual'