keynes42 commited on
Commit
ea28fbf
·
verified ·
1 Parent(s): 60939c5

Update app.py

Browse files

Update 'run_and_submit_all' to ensure the agent reads the attachments.

Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -313,9 +313,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
313
  print(f"An unexpected error occurred fetching questions: {e}")
314
  return f"An unexpected error occurred fetching questions: {e}", None
315
 
316
- questions_data = [questions_data[i] for i in [3,9,11,13,19]]
317
-
318
  # Find those with attachments
 
319
 
320
  # 3. Run your Agent
321
  results_log = []
@@ -323,9 +322,17 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
323
  print(f"Running agent on {len(questions_data)} questions...")
324
  for item in questions_data:
325
  print(item)
326
- print(item.keys())
327
  task_id = item.get("task_id")
328
  question_text = item.get("question")
 
 
 
 
 
 
 
 
 
329
  if not task_id or question_text is None:
330
  print(f"Skipping item with missing task_id or question: {item}")
331
  continue
 
313
  print(f"An unexpected error occurred fetching questions: {e}")
314
  return f"An unexpected error occurred fetching questions: {e}", None
315
 
 
 
316
  # Find those with attachments
317
+ # questions_data = [questions_data[i] for i in [3,9,11,13,19]]
318
 
319
  # 3. Run your Agent
320
  results_log = []
 
322
  print(f"Running agent on {len(questions_data)} questions...")
323
  for item in questions_data:
324
  print(item)
 
325
  task_id = item.get("task_id")
326
  question_text = item.get("question")
327
+
328
+ # Check for an associated filename and enhance the prompt
329
+ file_name = item.get("file_name")
330
+ if file_name:
331
+ # Construct a new prompt that includes the filename information
332
+ prompt_addition = f"\n[System Note: The file you need to analyze for this task is named '{file_name}'.]"
333
+ question_text = question_text + prompt_addition
334
+ print(f"Enhanced prompt for task {task_id}: {question_text}")
335
+
336
  if not task_id or question_text is None:
337
  print(f"Skipping item with missing task_id or question: {item}")
338
  continue