File size: 1,100 Bytes
b442094
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import json

questions_url  = "https://agents-course-unit4-scoring.hf.space/questions"
print(f"Fetching questions from: {questions_url}")
try:
    response = requests.get(questions_url, timeout=15)
    response.raise_for_status()
    questions_data = response.json()
    if not questions_data:
            print("Fetched questions list is empty.")
    else:
        print(f"Fetched {len(questions_data)} questions.")
        for sample in questions_data:
            print("="*20)
            print(f"Task ID: {sample['task_id']}")
            print(f"Origin GAIA File: {sample['file_name']}")
            print(f"Level: {sample['Level']}")
            print(f"Question: {sample['question']}")
            print("="*20)
except requests.exceptions.RequestException as e:
    print(f"Error fetching questions: {e}")
except requests.exceptions.JSONDecodeError as e:
        print(f"Error decoding JSON response from questions endpoint: {e}")
        print(f"Response text: {response.text[:500]}")
except Exception as e:
    print(f"An unexpected error occurred fetching questions: {e}")