sajjadzeak commited on
Commit
0342a89
·
verified ·
1 Parent(s): d27edc3

Delete debug_agent.py

Browse files
Files changed (1) hide show
  1. debug_agent.py +0 -57
debug_agent.py DELETED
@@ -1,57 +0,0 @@
1
- import argparse
2
- import textwrap
3
- from typing import Any
4
-
5
- import requests
6
-
7
- from app import DEFAULT_API_URL, GAIAAgent
8
-
9
-
10
- def fetch_question_row(task_id: str, api: str = DEFAULT_API_URL) -> dict[str, Any]:
11
- """Return the question dict associated with *task_id* (raises if not found)."""
12
- resp = requests.get(f"{api}/questions", timeout=15)
13
- resp.raise_for_status()
14
- for row in resp.json():
15
- if row["task_id"] == task_id:
16
- return row
17
- raise ValueError(f"task_id '{task_id}' not present in /questions.")
18
-
19
-
20
- def run_one(task_id: str | None, question: str | None) -> None:
21
- agent = GAIAAgent()
22
-
23
- if task_id:
24
- row = fetch_question_row(task_id)
25
- question = row["question"]
26
- print(f"\n{row}\n") # show full row incl. metadata
27
-
28
- # --- show pretty question
29
- print("=" * 90)
30
- print(f"QUESTION ({task_id or 'adhoc'})")
31
- print(textwrap.fill(question or "", width=90))
32
- print("=" * 90)
33
-
34
- assert question is not None, "Internal error: question was None"
35
- answer = agent(question, task_id=task_id)
36
- print(f"\nFINAL ANSWER --> {answer}")
37
-
38
-
39
- def parse_args() -> argparse.Namespace:
40
- parser = argparse.ArgumentParser(description="Run one GAIAAgent query locally.")
41
- parser.add_argument("--task_id", help="GAIA task_id to fetch & run")
42
- parser.add_argument("question", nargs="?", help="Ad-hoc question text (positional)")
43
-
44
- ns = parser.parse_args()
45
-
46
- # mutual-exclusion checks
47
- if ns.task_id and ns.question:
48
- parser.error("Provide either --task_id OR a question, not both.")
49
- if ns.task_id is None and ns.question is None:
50
- parser.error("You must supply a GAIA --task_id or a question.")
51
-
52
- return ns
53
-
54
-
55
- if __name__ == "__main__":
56
- args = parse_args()
57
- run_one(task_id=args.task_id, question=args.question)