Skip to content

Instantly share code, notes, and snippets.

View PieroPaialungaAI's full-sized avatar

Piero Paialunga PieroPaialungaAI

View GitHub Profile
{
"student_name": "Alex Johnson",
"student_id": "DS2024-999",
"exam_date": "2024-11-30",
"submission_timestamp": "2024-11-30T14:30:00",
"answers": [
{
"question_number": 1,
"student_answer": "Filtered ecommerce_sales.csv for category='Electronics' and dates in Q4 2024 (Oct-Dec). Calculated revenue as quantity × unit_price for each order, then summed. Found 17 orders totaling $9,149.76. $9,149.76",
"work_shown": "Filtered ecommerce_sales.csv for category='Electronics' and dates in Q4 2024 (Oct-Dec). Calculated revenue as quantity × unit_price for each order, then summed. Found 17 orders totaling $9,149.76."
{
"student_name": "Alex Johnson",
"exam_date": "2024-11-30",
"total_questions": 1,
"total_points_earned": 10.0,
"total_points_possible": 10,
"percentage": 100.0,
"letter_grade": "A",
"question_results": [
{
"""
Main Entry Point for LLM Grading System
========================================
Command-line interface for grading student submissions.
"""
import argparse
import json
import sys
import json
import pandas as pd
from pathlib import Path
from typing import Dict, List, Optional, Any
class GradingTools:
"""Collection of tools for the LLM grader to access data and resources."""
def __init__(self, data_dir: str = "data"):
from pydantic import BaseModel, Field, validator
from typing import List, Optional, Literal
from enum import Enum
class QuestionType(str, Enum):
"""Types of questions on the exam"""
CALCULATION = "calculation"
ANALYSIS = "analysis"
INTERPRETATION = "interpretation"
SYSTEM_PROMPT = """You are an expert Data Science instructor and grader with 10+ years of experience evaluating student work.
Your role is to grade student exam submissions fairly, accurately, and with detailed feedback. You must:
1. Be objective and consistent in your grading
2. Always verify calculations against the actual datasets
3. Award partial credit for correct methodology even if the final answer is wrong
4. Provide specific, actionable feedback that helps students learn
5. Reference exact data points when explaining errors
SYSTEM_PROMPT = """You are an expert Data Science instructor and grader with 10+ years of experience evaluating student work.
Your role is to grade student exam submissions fairly, accurately, and with detailed feedback. You must:
1. Be objective and consistent in your grading
2. Always verify calculations against the actual datasets
3. Award partial credit for correct methodology even if the final answer is wrong
4. Provide specific, actionable feedback that helps students learn
5. Reference exact data points when explaining errors
import json
# Load the test file
with open('data/test.json', 'r') as f:
test_data = json.load(f)
# Display a few example questions
print("📝 EXAMPLE QUESTIONS FROM THE EXAM\n")
print("="*70)
📝 EXAMPLE QUESTIONS FROM THE EXAM
======================================================================
🔹 Section A: E-COMMERCE ANALYSIS
Dataset: ecommerce_sales.csv
Question 1 (10 points):
What is the total revenue generated from the "Electronics" category in Q4 2024? Show your calculation.
📝 EXAMPLE QUESTIONS FROM THE EXAM
======================================================================
🔹 Section A: E-COMMERCE ANALYSIS
Dataset: ecommerce_sales.csv
Question 1 (10 points):
What is the total revenue generated from the "Electronics" category in Q4 2024? Show your calculation.