Download scripts/dry_run.py from DriptoBhattacharyya/Agent-Course-Submission: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/DriptoBhattacharyya/Agent-Course-Submission/resolve/main/scripts/dry_run.py
- Command line
-
hf download hf://spaces/DriptoBhattacharyya/Agent-Course-Submission/scripts/dry_run.py
-
curl -L -o dry_run.py https://huggingface.co/spaces/DriptoBhattacharyya/Agent-Course-Submission/resolve/main/scripts/dry_run.py
1.07 kB
| """Fetch all GAIA questions, run the agent locally, print answers — DO NOT submit. | |
| Usage (from the template dir, venv active): | |
| python scripts/dry_run.py # all questions | |
| python scripts/dry_run.py 3 # first 3 only | |
| """ | |
| from __future__ import annotations | |
| import sys | |
| import requests | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| from gaia_agent import GaiaAgent # noqa: E402 | |
| from gaia_agent.config import get_settings # noqa: E402 | |
| def main(limit: int | None) -> None: | |
| api = get_settings().gaia_api_url | |
| questions = requests.get(f"{api}/questions", timeout=30).json() | |
| if limit: | |
| questions = questions[:limit] | |
| agent = GaiaAgent() | |
| for i, item in enumerate(questions, 1): | |
| tid = item.get("task_id", "") | |
| qtext = item.get("question", "") | |
| answer = agent(qtext, tid) | |
| print(f"\n[{i}/{len(questions)}] task={tid}") | |
| print(f" Q: {qtext[:120]}...") | |
| print(f" A: {answer!r}") | |
| if __name__ == "__main__": | |
| n = int(sys.argv[1]) if len(sys.argv) > 1 else None | |
| main(n) | |