Skip to content

Commit 867683f

Browse files
authored
Athena: Update the Learner Profile Schema (#160)
1 parent ce27be8 commit 867683f

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

athena/athena/athena/schemas/learner_profile.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,37 @@ class LearnerProfile(BaseModel):
66
"""
77
Model representing learner profile.
88
9-
Each preference is on a scale from 1 to 5, where:
9+
Each preference is on a scale from 1 to 3, where:
1010
- 1 represents one extreme (e.g., focus on suggesting alternative solutions)
11-
- 5 represents the opposite extreme (e.g., focus on the standards)
11+
- 3 represents the opposite extreme (e.g., focus on the standards)
1212
"""
1313
feedback_alternative_standard: Annotated[int, Field(
14-
strict=True, ge=1, le=5,
15-
description="Preference for creative exploration and alternatives (1) vs de-facto standards (5)."
14+
strict=True, ge=1, le=3,
15+
description="Preference for creative exploration and alternatives (1) vs de-facto standards (3)."
1616
)]
1717
feedback_followup_summary: Annotated[int, Field(
18-
strict=True, ge=1, le=5,
19-
description="Preference for follow-up questions (1) vs summary/conclusion (5)."
18+
strict=True, ge=1, le=3,
19+
description="Preference for follow-up questions (1) vs summary/conclusion (3)."
2020
)]
2121
feedback_brief_detailed: Annotated[int, Field(
22-
strict=True, ge=1, le=5,
23-
description="Preference for brief (1) vs detailed (5) feedback."
22+
strict=True, ge=1, le=3,
23+
description="Preference for brief (1) vs detailed (3) feedback."
2424
)]
2525

26+
class Config:
27+
@staticmethod
28+
def alias_generator(s: str) -> str:
29+
return ''.join([s.split('_')[0]] + [word.capitalize() for word in s.split('_')[1:]])
30+
allow_population_by_field_name = True
31+
2632
def directive_alternative_standard(self) -> str:
27-
if self.feedback_alternative_standard <= 2:
33+
if self.feedback_alternative_standard == 1:
2834
return (
2935
"Encourage exploration by suggesting alternative approaches or creative methods.\n"
3036
"Example 1: Besides QuickSort, you could also explore MergeSort or InsertionSort depending on the dataset characteristics.\n"
3137
"Example 2: Instead of writing a formal essay, you could experiment with a narrative storytelling approach to engage the reader differently.\n"
3238
)
33-
if self.feedback_alternative_standard == 3:
39+
if self.feedback_alternative_standard == 2:
3440
return (
3541
"Present the standard solution clearly, but briefly mention one alternative approach.\n"
3642
"Example 1: QuickSort is efficient for large datasets, but for nearly sorted data, InsertionSort could be faster.\n"
@@ -44,7 +50,7 @@ def directive_alternative_standard(self) -> str:
4450
)
4551

4652
def directive_followup_summary(self) -> str:
47-
if self.feedback_followup_summary <= 3:
53+
if self.feedback_followup_summary <= 2:
4854
return (
4955
"End the feedback with a clear, specific follow-up question that promotes reflection.\n"
5056
"- If the answer is partially incorrect: Ask a focused question that hints at the mistake without giving away the solution.\n"
@@ -64,13 +70,13 @@ def directive_followup_summary(self) -> str:
6470
)
6571

6672
def directive_brief_detailed(self) -> str:
67-
if self.feedback_brief_detailed <= 2:
73+
if self.feedback_brief_detailed == 1:
6874
return (
6975
"Keep the feedback short and direct — ideally 1 to 2 sentences.\n"
7076
"Example 1: Add an index on the user_id column to improve performance.\n"
7177
"Example 2: Clarify your thesis statement in the introduction to strengthen your argument.\n"
7278
)
73-
if self.feedback_brief_detailed == 3:
79+
if self.feedback_brief_detailed == 2:
7480
return (
7581
"Provide moderately detailed feedback, giving clear explanations without unnecessary length.\n"
7682
"Example 1: Consider indexing user_id to speed up lookups; it helps databases quickly find matching records\n."

athena/modules/text/module_text_llm/module_text_llm/cot_learner_profile/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ class COTLearnerProfileConfig(ApproachConfig):
1414
thinking_prompt: ThinkingPrompt = Field(default=ThinkingPrompt())
1515
generate_suggestions_prompt: GenerateSuggestionsPrompt = Field(default=GenerateSuggestionsPrompt())
1616
profile: LearnerProfile = Field(default=LearnerProfile(
17-
feedback_practical_theoretical=3,
18-
feedback_alternative_standard=3,
19-
feedback_followup_summary=3,
20-
feedback_brief_detailed=3
17+
feedback_alternative_standard=2,
18+
feedback_followup_summary=2,
19+
feedback_brief_detailed=2
2120
))
2221

2322
async def generate_suggestions(self, exercise: Exercise, submission: Submission, config, *, debug: bool,

athena/modules/text/module_text_llm/module_text_llm/cot_learner_profile/generate_suggestions.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ async def generate_suggestions(exercise: Exercise, submission: Submission, confi
2929
if learner_profile is None:
3030
logger.info("Learner profile was not provided - continuing with the default values.")
3131
learner_profile = LearnerProfile(
32-
feedback_practical_theoretical=3,
33-
feedback_alternative_standard=3,
34-
feedback_followup_summary=3,
35-
feedback_brief_detailed=3
32+
feedback_alternative_standard=2,
33+
feedback_followup_summary=2,
34+
feedback_brief_detailed=2
3635
)
3736

3837
# Inject student preferences into the prompt

0 commit comments

Comments
 (0)