File size: 1,068 Bytes
cb1b811 | 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 | """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)
|