File size: 3,084 Bytes
99f0ea4
ec07723
99f0ea4
ec07723
99f0ea4
 
 
ec07723
 
99f0ea4
 
ec07723
e0e55e2
06d5276
ec07723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99f0ea4
 
ec07723
 
 
 
 
 
 
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---

title: GAIA Agent Space
emoji: "🔥"
colorFrom: indigo
colorTo: red
sdk: gradio
sdk\_version: 5.29.0
app\_file: app.py
pinned: false
license: mit

hf_oauth: true  

---

# GAIA Agent Space

A reproduction‑ready **Retrieval‑Augmented Generation (RAG) agent** built with **LangChain** and **Gradio** for the [GAIA benchmark](https://arxiv.org/abs/2311.12983).  The Space exposes both an interactive web UI *and* a programmatic `/predict` endpoint, making it easy to test single GAIA tasks or to batch‑evaluate whole splits with the Inspect‑AI runner.

## ✨ Demo

> Click **<Run>** above ⬆️ and paste a GAIA JSON task – or just try something like:
>
> ```json
> {"question": "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)?"}
> ```

The agent decides which tool chain to invoke (Wikipedia search, table parser, etc.) and returns the numeric answer in the GAIA `SUBMIT:` format.

## 🚀 Quick start (local)

```bash
# 1 ‑ clone
git clone https://huggingface.co/spaces/Acecross/GAIA_agent_space
cd GAIA_agent_space

# 2 ‑ create env
conda env create -f environment.yml   # or: python -m venv .venv && pip install -r requirements.txt
conda activate gaia‑agent

# 3 ‑ run UI
python app.py       # Gradio launches at http://127.0.0.1:7860
```

## 🛠️  Environment variables

| Variable         | Purpose                                                                                         |
| ---------------- | ----------------------------------------------------------------------------------------------- |
| `HF_API_TOKEN`   | *Optional* – needed only if you hit the Hugging Face Inference API or gated models.             |
| `OPENAI_API_KEY` | *Optional* – set to use OpenAI models for LLM or vision tasks.                                  |
| `TAVILY_API_KEY` | API key for web search (used by the `TavilySearchTool`).                                        |
| `STOCKFISH_PATH` | Path to the Stockfish binary for chess‑position questions (defaults to `stockfish` in `$PATH`). |

Create a `.env` file with any keys you need; `app.py` loads it on start‑up.

## 📁 Project layout

```
├─ app.py                # Gradio interface + agent bootstrap
├─ agent/
│  ├─ chains.py          # LangChain boiler plate (router, retriever, etc.)
│  ├─ tools/             # Custom tool classes (spreadsheet, chess, video counter…)
│  └─ prompts/
├─ requirements.txt      # runtime deps
└─ environment.yml       # conda lock (optional)
```

## 📝 License

This project is released under the **MIT License** – see [`LICENSE`](./LICENSE) for details.

---

### 🔗 Useful links

* GAIA paper: [https://arxiv.org/abs/2311.12983](https://arxiv.org/abs/2311.12983)
* LangChain docs: [https://python.langchain.com](https://python.langchain.com)
* Hugging Face Spaces: [https://huggingface.co/docs/hub/spaces](https://huggingface.co/docs/hub/spaces)

Feel free to open an issue or a pull request if you spot a bug or want to add a new GAIA‑specific tool! 🎉