File size: 1,085 Bytes
55c26dd
8d662cb
71aee2a
 
8d662cb
 
 
 
 
 
 
 
71aee2a
8d662cb
 
 
 
 
 
71aee2a
8d662cb
 
 
 
 
 
cf54414
 
8d662cb
 
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
from questions import get_all_questions
from gaia_interface import submit_to_leaderboard

def run_and_submit_all(agent):
    print("✅ [Checkpoint 1] Loading questions...")
    try:
        questions = get_all_questions()
    except Exception as e:
        return f"❌ Failed to load questions: {e}"

    print(f"✅ [Checkpoint 2] Loaded {len(questions)} questions.")

    answers = []
    for i, q in enumerate(questions):
        print(f"➡️  [Checkpoint 3.{i}] Processing question ID: {q.get('id', 'UNKNOWN')}")
        try:
            answer = agent.answer_question(q)
        except Exception as e:
            return f"❌ Failed while answering question {q.get('id', 'UNKNOWN')}: {e}"
        answers.append({"question_id": q["id"], "answer": answer})

    print("✅ [Checkpoint 4] All answers generated. Preparing submission...")

    try:
        result = submit_to_leaderboard(answers)
        print("✅ [Checkpoint 5] Submission succeeded.")
        return f"✅ Submission result:\n{result}"

    except Exception as e:
        return f"❌ Submission failed: {e}"