sravaniamere's picture
Fix server.py, expand tasks to 40, add tests, clean observation schema
2194233
Raw
History Blame Contribute Delete
4.82 kB
from sql_env.models import SQLTask
from sql_env.grader import grade
EASY_TASKS = [
SQLTask(
task_id="easy_001",
difficulty="easy",
broken_query="SELECT * FORM users WHERE id = 1",
canonical_answer="SELECT * FROM users WHERE id = 1",
error_hint="There is a typo in a SQL keyword near the table name.",
grader=grade,
),
SQLTask(
task_id="easy_002",
difficulty="easy",
broken_query="SELECT name, age FORM employees WHERE department = 'HR'",
canonical_answer="SELECT name, age FROM employees WHERE department = 'HR'",
error_hint="There is a typo in a SQL keyword near the table name.",
grader=grade,
),
SQLTask(
task_id="easy_003",
difficulty="easy",
broken_query="SELECT * FROM products WEHRE price > 100",
canonical_answer="SELECT * FROM products WHERE price > 100",
error_hint="There is a typo in the filtering keyword.",
grader=grade,
),
SQLTask(
task_id="easy_004",
difficulty="easy",
broken_query="SELCT id, name FROM customers",
canonical_answer="SELECT id, name FROM customers",
error_hint="There is a typo in the first keyword of the query.",
grader=grade,
),
SQLTask(
task_id="easy_005",
difficulty="easy",
broken_query="SELECT COUNT(*) FORM orders WHERE status = 'pending'",
canonical_answer="SELECT COUNT(*) FROM orders WHERE status = 'pending'",
error_hint="There is a typo in a SQL keyword near the table name.",
grader=grade,
),
SQLTask(
task_id="easy_006",
difficulty="easy",
broken_query="SELECT id, email FORM users WHERE active = 1",
canonical_answer="SELECT id, email FROM users WHERE active = 1",
error_hint="There is a typo in a SQL keyword near the table name.",
grader=grade,
),
SQLTask(
task_id="easy_007",
difficulty="easy",
broken_query="SELECT * FROM invoices WEHRE amount > 500",
canonical_answer="SELECT * FROM invoices WHERE amount > 500",
error_hint="There is a typo in the filtering keyword.",
grader=grade,
),
SQLTask(
task_id="easy_008",
difficulty="easy",
broken_query="SELCT title, author FROM books",
canonical_answer="SELECT title, author FROM books",
error_hint="There is a typo in the first keyword of the query.",
grader=grade,
),
SQLTask(
task_id="easy_009",
difficulty="easy",
broken_query="SELECT name FORM departments WHERE location = 'NYC'",
canonical_answer="SELECT name FROM departments WHERE location = 'NYC'",
error_hint="There is a typo in a SQL keyword near the table name.",
grader=grade,
),
SQLTask(
task_id="easy_010",
difficulty="easy",
broken_query="SELECT product_name, price FROM catalog WEHRE category = 'electronics'",
canonical_answer="SELECT product_name, price FROM catalog WHERE category = 'electronics'",
error_hint="There is a typo in the filtering keyword.",
grader=grade,
),
SQLTask(
task_id="easy_011",
difficulty="easy",
broken_query="SELECT * FORM sessions WHERE user_id = 42",
canonical_answer="SELECT * FROM sessions WHERE user_id = 42",
error_hint="There is a typo in a SQL keyword near the table name.",
grader=grade,
),
SQLTask(
task_id="easy_012",
difficulty="easy",
broken_query="SELCT COUNT(*) FROM transactions WHERE type = 'credit'",
canonical_answer="SELECT COUNT(*) FROM transactions WHERE type = 'credit'",
error_hint="There is a typo in the first keyword of the query.",
grader=grade,
),
SQLTask(
task_id="easy_013",
difficulty="easy",
broken_query="SELECT username, created_at FORM accounts WHERE verified = 1",
canonical_answer="SELECT username, created_at FROM accounts WHERE verified = 1",
error_hint="There is a typo in a SQL keyword near the table name.",
grader=grade,
),
SQLTask(
task_id="easy_014",
difficulty="easy",
broken_query="SELECT * FROM reports WEHRE year = 2024",
canonical_answer="SELECT * FROM reports WHERE year = 2024",
error_hint="There is a typo in the filtering keyword.",
grader=grade,
),
SQLTask(
task_id="easy_015",
difficulty="easy",
broken_query="SELCT AVG(score) FROM results WHERE subject = 'math'",
canonical_answer="SELECT AVG(score) FROM results WHERE subject = 'math'",
error_hint="There is a typo in the first keyword of the query.",
grader=grade,
),
]