Spaces:
Paused
Paused
| """ | |
| Shared interfaces for all components. | |
| DO NOT MODIFY - must match teacher and task generator teams. | |
| """ | |
| from dataclasses import dataclass | |
| from typing import List, Dict | |
| from abc import ABC, abstractmethod | |
| class Task: | |
| """A reading comprehension task.""" | |
| passage: str | |
| question: str | |
| choices: List[str] # 4 choices: ['A) ...', 'B) ...', 'C) ...', 'D) ...'] | |
| answer: int # Index of correct answer (0-3) | |
| topic: str # e.g., 'history', 'science', 'literature', 'geography', 'current_events' | |
| difficulty: str # 'easy', 'medium', 'hard' | |
| task_id: str | |
| class StudentState: | |
| """Student's current learning state.""" | |
| topic_accuracies: Dict[str, float] # topic -> accuracy (0.0-1.0) | |
| topic_attempts: Dict[str, int] # topic -> number of attempts | |
| time_since_practice: Dict[str, float] # topic -> time since last practice | |
| total_timesteps: int | |
| current_time: float | |
| class TeacherAction: | |
| """Teacher's decision about what to teach next.""" | |
| topic: str | |
| difficulty: str | |
| is_review: bool | |
| class TaskGeneratorInterface(ABC): | |
| def generate_task(self, topic: str, difficulty: str) -> Task: | |
| pass | |
| def get_available_topics(self) -> List[str]: | |
| pass | |
| def get_available_difficulties(self) -> List[str]: | |
| pass | |
| class StudentAgentInterface(ABC): | |
| def answer(self, task: Task) -> int: | |
| """Predict answer to a task (before learning).""" | |
| pass | |
| def learn(self, task: Task) -> bool: | |
| """Learn from a task. Returns True if answer was correct.""" | |
| pass | |
| def evaluate(self, eval_tasks: List[Task]) -> float: | |
| """Evaluate on held-out test set. Returns accuracy (0.0-1.0).""" | |
| pass | |
| def get_state(self) -> StudentState: | |
| """Get current state for teacher to observe.""" | |
| pass | |
| def advance_time(self, delta: float = 1.0): | |
| """Advance time for forgetting simulation.""" | |
| pass | |
| class TeacherAgentInterface(ABC): | |
| def select_action(self, student_state: StudentState) -> TeacherAction: | |
| pass | |
| def update(self, action: TeacherAction, reward: float): | |
| pass | |
| def get_statistics(self) -> Dict: | |
| pass | |