Update app.py
Browse files
app.py
CHANGED
|
@@ -475,22 +475,23 @@ def process_all_questions(agent: ChuckAgent, questions_data: List[Dict[str, Any]
|
|
| 475 |
print(f"DEBUG: Processing task {i+1}/{len(questions_data)}, ID: {task_id}")
|
| 476 |
try:
|
| 477 |
model_ans, reasoning = agent(question_text)
|
| 478 |
-
#
|
| 479 |
payload_item = {"task_id": task_id, "submitted_answer": model_ans}
|
| 480 |
if reasoning:
|
| 481 |
payload_item["reasoning_trace"] = reasoning
|
| 482 |
answers_payload.append(payload_item)
|
| 483 |
|
|
|
|
| 484 |
results_log_data.append({
|
| 485 |
"Task ID": task_id, "Question": question_text,
|
| 486 |
-
"Submitted Answer": model_ans,
|
| 487 |
"Reasoning Trace": reasoning
|
| 488 |
})
|
| 489 |
except Exception as e:
|
| 490 |
print(f"DEBUG: ERROR - Error running agent on task {task_id}: {e}")
|
| 491 |
logger.error(f"Error running agent on task {task_id} ('{question_text[:50]}...'): {e}", exc_info=True)
|
| 492 |
error_answer = f"AGENT_CALL_ERROR: {str(e)}"
|
| 493 |
-
#
|
| 494 |
answers_payload.append({"task_id": task_id, "submitted_answer": error_answer, "reasoning_trace": str(e)})
|
| 495 |
results_log_data.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": error_answer, "Reasoning Trace": str(e)})
|
| 496 |
print(f"DEBUG: process_all_questions finished. Produced {len(answers_payload)} answers.")
|
|
@@ -504,7 +505,6 @@ def submit_answers(base_api_url: str, username: str, agent_code_url: str, answer
|
|
| 504 |
submit_url = f"{base_api_url}{CONFIG.SUBMIT_URL_PATH}"
|
| 505 |
submission_data = {"username": username.strip(), "agent_code": agent_code_url, "answers": answers_payload}
|
| 506 |
|
| 507 |
-
# Debug: Print a snippet of the submission data to verify the key change
|
| 508 |
if answers_payload:
|
| 509 |
print(f"DEBUG: Sample of first answer payload being sent: {answers_payload[0]}")
|
| 510 |
|
|
|
|
| 475 |
print(f"DEBUG: Processing task {i+1}/{len(questions_data)}, ID: {task_id}")
|
| 476 |
try:
|
| 477 |
model_ans, reasoning = agent(question_text)
|
| 478 |
+
# Use 'submitted_answer' as the key for the server payload
|
| 479 |
payload_item = {"task_id": task_id, "submitted_answer": model_ans}
|
| 480 |
if reasoning:
|
| 481 |
payload_item["reasoning_trace"] = reasoning
|
| 482 |
answers_payload.append(payload_item)
|
| 483 |
|
| 484 |
+
# For local logging, you can keep 'Submitted Answer' or change it if you prefer
|
| 485 |
results_log_data.append({
|
| 486 |
"Task ID": task_id, "Question": question_text,
|
| 487 |
+
"Submitted Answer": model_ans,
|
| 488 |
"Reasoning Trace": reasoning
|
| 489 |
})
|
| 490 |
except Exception as e:
|
| 491 |
print(f"DEBUG: ERROR - Error running agent on task {task_id}: {e}")
|
| 492 |
logger.error(f"Error running agent on task {task_id} ('{question_text[:50]}...'): {e}", exc_info=True)
|
| 493 |
error_answer = f"AGENT_CALL_ERROR: {str(e)}"
|
| 494 |
+
# Use 'submitted_answer' as the key for the server payload in error cases too
|
| 495 |
answers_payload.append({"task_id": task_id, "submitted_answer": error_answer, "reasoning_trace": str(e)})
|
| 496 |
results_log_data.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": error_answer, "Reasoning Trace": str(e)})
|
| 497 |
print(f"DEBUG: process_all_questions finished. Produced {len(answers_payload)} answers.")
|
|
|
|
| 505 |
submit_url = f"{base_api_url}{CONFIG.SUBMIT_URL_PATH}"
|
| 506 |
submission_data = {"username": username.strip(), "agent_code": agent_code_url, "answers": answers_payload}
|
| 507 |
|
|
|
|
| 508 |
if answers_payload:
|
| 509 |
print(f"DEBUG: Sample of first answer payload being sent: {answers_payload[0]}")
|
| 510 |
|