|
5 | 5 | from .schemas.result import Result |
6 | 6 | from .correction import analyze_fsa_correction |
7 | 7 |
|
8 | | - |
9 | | - |
10 | 8 | def evaluation_function( |
11 | | - response: Any, |
12 | | - answer: Any, |
13 | | - params: Params, |
| 9 | + payload: Any |
14 | 10 | ) -> LFResult: |
15 | | - """ |
16 | | - Evaluate a student's FSA response against the expected answer. |
| 11 | + return LFResult( |
| 12 | + is_correct=False, |
| 13 | + feedback_items=[("error", f"{payload}")] |
| 14 | + ) |
| 15 | + |
| 16 | +# def evaluation_function( |
| 17 | +# response: Any, |
| 18 | +# answer: Any, |
| 19 | +# params: Params, |
| 20 | +# ) -> LFResult: |
| 21 | +# """ |
| 22 | +# Evaluate a student's FSA response against the expected answer. |
17 | 23 |
|
18 | | - Args: |
19 | | - response: Student's FSA (dict with states, alphabet, transitions, etc.), since frontend constriants, this is FSAFrontend |
20 | | - answer: Expected FSA still, FSAFrontend for the same reason |
21 | | - params: Extra parameters (e.g., require_minimal) |
| 24 | +# Args: |
| 25 | +# response: Student's FSA (dict with states, alphabet, transitions, etc.), since frontend constriants, this is FSAFrontend |
| 26 | +# answer: Expected FSA still, FSAFrontend for the same reason |
| 27 | +# params: Extra parameters (e.g., require_minimal) |
22 | 28 |
|
23 | | - Returns: |
24 | | - LFResult with is_correct and feedback |
25 | | - """ |
26 | | - try: |
27 | | - # Parse FSAs from input |
28 | | - student_fsa_ = FSAFrontend.model_validate(response) |
29 | | - expected_fsa_ = FSAFrontend.model_validate(answer) |
| 29 | +# Returns: |
| 30 | +# LFResult with is_correct and feedback |
| 31 | +# """ |
| 32 | +# try: |
| 33 | +# # Parse FSAs from input |
| 34 | +# student_fsa_ = FSAFrontend.model_validate(response) |
| 35 | +# expected_fsa_ = FSAFrontend.model_validate(answer) |
30 | 36 |
|
31 | | - student_fsa = student_fsa_.from_flattened() |
32 | | - expected_fsa = expected_fsa_.from_flattened() |
| 37 | +# student_fsa = student_fsa_.from_flattened() |
| 38 | +# expected_fsa = expected_fsa_.from_flattened() |
33 | 39 |
|
34 | 40 |
|
35 | | - # Get require_minimal from params if present |
36 | | - require_minimal = params.get("require_minimal", False) if hasattr(params, "get") else False |
| 41 | +# # Get require_minimal from params if present |
| 42 | +# require_minimal = params.get("require_minimal", False) if hasattr(params, "get") else False |
37 | 43 |
|
38 | | - # Run correction pipeline |
39 | | - result: Result = analyze_fsa_correction(student_fsa, expected_fsa, require_minimal) |
| 44 | +# # Run correction pipeline |
| 45 | +# result: Result = analyze_fsa_correction(student_fsa, expected_fsa, require_minimal) |
40 | 46 |
|
41 | | - # Convert to lf_toolkit Result |
42 | | - return LFResult( |
43 | | - is_correct=result.is_correct, |
44 | | - feedback_items=[("feedback", result.feedback)] |
45 | | - ) |
| 47 | +# # Convert to lf_toolkit Result |
| 48 | +# return LFResult( |
| 49 | +# is_correct=result.is_correct, |
| 50 | +# feedback_items=[("feedback", result.feedback)] |
| 51 | +# ) |
46 | 52 |
|
47 | | - except Exception as e: |
48 | | - return LFResult( |
49 | | - is_correct=False, |
50 | | - feedback_items=[("error", f"Invalid FSA format: {str(e)}, received: \n\nresponse: {response}\n\n answer: {answer}, \n\nparams: {params}")] |
51 | | - ) |
| 53 | +# except Exception as e: |
| 54 | +# return LFResult( |
| 55 | +# is_correct=False, |
| 56 | +# feedback_items=[("error", f"Invalid FSA format: {str(e)}, received: \n\nresponse: {response}\n\n answer: {answer}, \n\nparams: {params}")] |
| 57 | +# ) |
0 commit comments