Skip to content

Commit b89284a

Browse files
committed
fix: simplify schemsa
1 parent ba53c52 commit b89284a

File tree

3 files changed

+638
-678
lines changed

3 files changed

+638
-678
lines changed

evaluation_function/evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def evaluation_function(
123123
parser = PseudocodeParser()
124124
parse_result = parser.parse(pseudocode)
125125

126-
if not parse_result.success and params_model.strict_parsing:
126+
if not parse_result.success:# and params_model.strict_parsing:
127127
result = Result(is_correct=False)
128128
result.add_feedback("error", _format_parse_error(parse_result))
129129
return result

evaluation_function/schemas/input_schema.py

Lines changed: 21 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -68,59 +68,17 @@ class EvaluationParams(BaseModel):
6868
Configuration parameters for the evaluation.
6969
"""
7070

71-
analyze_pseudocode: bool = True
7271
require_time_complexity: bool = True
7372
require_space_complexity: bool = True
7473

75-
# never used
76-
partial_credit: bool = True
77-
time_weight: float = Field(default=0.5, ge=0.0, le=1.0)
78-
space_weight: float = Field(default=0.5, ge=0.0, le=1.0)
79-
80-
# never used
81-
complexity_equivalence: bool = True
82-
83-
# never used
84-
case_sensitive: bool = False
85-
strict_notation: bool = False
86-
8774
show_detailed_feedback: bool = True
88-
# never used
89-
show_correct_answer: bool = True
90-
# never used
91-
show_detected_complexity: bool = True
92-
# never used
93-
show_ast: bool = False
94-
95-
# never used
96-
pseudocode_style: str = Field(default="auto")
97-
98-
strict_parsing: bool = False
99-
100-
# never used
101-
max_nesting_depth: int = Field(default=10, ge=1, le=50)
102-
timeout_seconds: float = Field(default=5.0, ge=0.1, le=60.0)
10375

10476
model_config = ConfigDict(
10577
json_schema_extra={
10678
"example": {
107-
"analyze_pseudocode": True,
10879
"require_time_complexity": True,
10980
"require_space_complexity": True,
110-
"partial_credit": True,
111-
"time_weight": 0.5,
112-
"space_weight": 0.5,
113-
"complexity_equivalence": True,
114-
"case_sensitive": False,
115-
"strict_notation": False,
116-
"show_detailed_feedback": True,
117-
"show_correct_answer": True,
118-
"show_detected_complexity": True,
119-
"show_ast": False,
120-
"pseudocode_style": "auto",
121-
"strict_parsing": False,
122-
"max_nesting_depth": 10,
123-
"timeout_seconds": 5.0
81+
"show_detailed_feedback": True
12482
}
12583
}
12684
)
@@ -140,16 +98,11 @@ class ExpectedAnswer(BaseModel):
14098
description="Expected space complexity in Big-O notation"
14199
)
142100

143-
acceptable_time_alternatives: List[str] = Field(default_factory=list)
144-
acceptable_space_alternatives: List[str] = Field(default_factory=list)
145-
146-
algorithm_description: Optional[str] = None
147-
algorithm_type: Optional[str] = None
148-
149-
expected_constructs: List[str] = Field(default_factory=list)
101+
# algorithm_description: Optional[str] = None
102+
# algorithm_type: Optional[str] = None
150103

151-
time_complexity_weight: float = Field(default=0.5, ge=0.0, le=1.0)
152-
space_complexity_weight: float = Field(default=0.5, ge=0.0, le=1.0)
104+
# maybe a TODO? can check for the presence of constructs
105+
# expected_constructs: List[str] = Field(default_factory=list)
153106

154107
test_cases: List[ExecutionTestCase] = Field(
155108
default_factory=list,
@@ -158,24 +111,29 @@ class ExpectedAnswer(BaseModel):
158111

159112
eval_options: Optional[EvaluationParams] = None
160113

161-
def get_all_acceptable_time(self) -> List[str]:
162-
return [self.expected_time_complexity] + self.acceptable_time_alternatives
114+
# def get_all_acceptable_time(self) -> List[str]:
115+
# return [self.expected_time_complexity] + self.acceptable_time_alternatives
163116

164-
def get_all_acceptable_space(self) -> List[str]:
165-
return [self.expected_space_complexity] + self.acceptable_space_alternatives
117+
# def get_all_acceptable_space(self) -> List[str]:
118+
# return [self.expected_space_complexity] + self.acceptable_space_alternatives
166119

167120
model_config = ConfigDict(
168121
json_schema_extra={
169122
"example": {
170123
"expected_time_complexity": "O(n^2)",
171124
"expected_space_complexity": "O(1)",
172-
"acceptable_time_alternatives": ["O(n*n)", "O(n²)"],
173-
"acceptable_space_alternatives": [],
174-
"algorithm_description": "Matrix traversal with nested loops",
175-
"algorithm_type": "iteration",
176-
"expected_constructs": ["nested_loop"],
177-
"time_complexity_weight": 0.6,
178-
"space_complexity_weight": 0.4
125+
"eval_options": {
126+
"require_time_complexity": True,
127+
"require_space_complexity": True,
128+
"show_detailed_feedback": True
129+
}
130+
# "acceptable_time_alternatives": ["O(n*n)", "O(n²)"],
131+
# "acceptable_space_alternatives": [],
132+
# "algorithm_description": "Matrix traversal with nested loops",
133+
# "algorithm_type": "iteration",
134+
# "expected_constructs": ["nested_loop"],
135+
# "time_complexity_weight": 0.6,
136+
# "space_complexity_weight": 0.4
179137
}
180138
}
181139
)

0 commit comments

Comments
 (0)