FD900's picture
Update run.py
cf54414 verified
raw
history blame
1.09 kB
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}"