GAIA_v5 / README.md
Gralon's picture
Upload 4 files
dab1aa6 verified

A newer version of the Gradio SDK is available: 6.13.0

Upgrade
metadata
title: GAIA Agent - Hugging Face Agents Course
emoji: 🧠
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480

GAIA Agent - Hugging Face Agents Course

This project implements an intelligent agent for the final assessment of the Hugging Face Agents course. The agent is designed to achieve a score of 30% or higher on the GAIA benchmark.

Features

  • Efficient Implementation: Minimal yet powerful solution using smolagents
  • OpenAI Integration: Option to use gpt-4o-mini (cost efficient) or gpt-4o (higher accuracy)
  • Web Search Capabilities: Leverages DuckDuckGo search with rate limiting protections
  • File Processing: Handles various file types like CSV, Excel, and images
  • Reverse Text Detection: Automatically detects and handles reversed text questions
  • Cost Controls: Sample size slider and model selection options to manage API costs

Usage

  1. Clone this repository
  2. Install the required dependencies:
pip install -r requirements.txt
  1. Create a .env file with your OpenAI API key:
OPENAI_API_KEY=your_key_here
OPENAI_MODEL_ID=gpt-4o-mini  # or gpt-4o for higher accuracy
  1. Run the application:
python app.py

How it Works

The agent uses a CodeAgent from smolagents with enhanced prompting and multiple tools to solve the GAIA questions. It employs a straightforward approach that:

  1. Receives questions from the GAIA API
  2. Processes questions with specialized handling for reversed text
  3. Uses appropriate tools based on the question type
  4. Returns precise answers in the expected format

The agent is specifically designed to follow the GAIA benchmark format requirements, ensuring all answers are provided in the exact format expected by the evaluation system.

Tools

  • Web search (DuckDuckGo with rate limiting protection)
  • Reverse text analysis
  • File processing tools for CSV and Excel files
  • Image OCR capabilities
  • Date and time utilities
  • File download handling

Deployment

To deploy on Hugging Face Spaces:

  1. Create a new Space on Hugging Face
  2. Upload all files from this repository (EXCLUDING the .env file)
  3. Add the following secrets in your Space settings:
    • OPENAI_API_KEY: Your OpenAI API key
    • OPENAI_MODEL_ID: The model to use (gpt-4o-mini or gpt-4o)
  4. Set HF_OAUTH to true in your Space settings to enable login/authentication

Testing

You can use the test_single.py script to test the agent with individual questions locally:

python test_single.py

This helps verify functionality without incurring high API costs during development.