tfrere commited on
Commit
7839773
·
1 Parent(s): da60a9e

update benchmark displayed questions

Browse files
Files changed (1) hide show
  1. backend/routes/questions.py +3 -26
backend/routes/questions.py CHANGED
@@ -32,14 +32,12 @@ async def get_benchmark_questions(session_id: str):
32
  questions = []
33
 
34
  try:
35
- # Essayer de charger les questions single-shot directement avec le nom de config
36
  single_dataset = load_dataset(dataset_repo_id, 'single_shot_questions')
37
  if single_dataset and len(single_dataset['train']) > 0:
38
- # Prendre 2 questions à partir de l'index 1 (en évitant la première question)
39
  start_idx = 1
40
- max_questions = min(5, max(0, len(single_dataset['train']) - start_idx))
41
- for i in range(max_questions):
42
- idx = start_idx + i
43
  questions.append({
44
  "id": str(idx),
45
  "question": single_dataset['train'][idx].get("question", ""),
@@ -50,27 +48,6 @@ async def get_benchmark_questions(session_id: str):
50
  except Exception as e:
51
  print(f"Error loading single-shot questions: {str(e)}")
52
 
53
- # try:
54
- # # Essayer de charger les questions multi-hop si nécessaire
55
- # if len(questions) < 2:
56
- # multi_dataset = load_dataset(dataset_repo_id, 'multi_hop_questions')
57
- # if multi_dataset and len(multi_dataset['train']) > 0:
58
- # # Prendre les questions multi-hop pour compléter, en évitant aussi la première
59
- # start_idx = 1
60
- # remaining = 2 - len(questions)
61
- # max_questions = min(remaining, max(0, len(multi_dataset['train']) - start_idx))
62
- # for i in range(max_questions):
63
- # idx = start_idx + i
64
- # questions.append({
65
- # "id": str(idx),
66
- # "question": multi_dataset['train'][idx].get("question", ""),
67
- # "answer": multi_dataset['train'][idx].get("self_answer", "No answer available"),
68
- # "type": "multi_hop"
69
- # })
70
- # print(f"Loaded {len(questions)} multi-hop questions")
71
- # except Exception as e:
72
- # print(f"Error loading multi-hop questions: {str(e)}")
73
-
74
  # If we couldn't load any questions, the dataset might not exist
75
  if len(questions) == 0:
76
  # Check if we have a directory for this session locally as fallback
 
32
  questions = []
33
 
34
  try:
35
+ # Try to load single-shot questions directly with the config name
36
  single_dataset = load_dataset(dataset_repo_id, 'single_shot_questions')
37
  if single_dataset and len(single_dataset['train']) > 0:
38
+ # Take all questions starting from index 1 (avoiding the first question)
39
  start_idx = 1
40
+ for idx in range(start_idx, len(single_dataset['train'])):
 
 
41
  questions.append({
42
  "id": str(idx),
43
  "question": single_dataset['train'][idx].get("question", ""),
 
48
  except Exception as e:
49
  print(f"Error loading single-shot questions: {str(e)}")
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  # If we couldn't load any questions, the dataset might not exist
52
  if len(questions) == 0:
53
  # Check if we have a directory for this session locally as fallback