Skip to content

Commit 9aab82b

Browse files
committed
feat: try config
1 parent e85abe7 commit 9aab82b

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

evaluation_function/evaluation.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def validate_fsa(value: str | dict) -> FSA:
99
"""Parse a FSA from JSON string or dict."""
1010
if isinstance(value, str):
1111
return FSAFrontend.model_validate_json(value).toFSA()
12-
return FSAFrontend.model_validate(value).toFSA()
12+
return FSAFrontend.model_validate(value).toFSA(), FSAFrontend.model_validate(value).config
1313

1414
def evaluation_function(
1515
response: Any = None,
@@ -33,16 +33,9 @@ def evaluation_function(
3333
f"Missing FSA data: response or answer is None\n"
3434
f"response: {response}\nanswer: {answer}"
3535
)
36-
# Extract and remove config from answer
37-
raw_config = "{}"
38-
if isinstance(answer, dict):
39-
raw_config = answer.pop("config", "{}")
40-
41-
config = json.loads(raw_config)
42-
4336
# Parse FSAs
44-
student_fsa = validate_fsa(response)
45-
expected_fsa = validate_fsa(answer)
37+
student_fsa, student_config = validate_fsa(response)
38+
expected_fsa, expected_config = validate_fsa(answer)
4639

4740
require_minimal = params.get("require_minimal", False) if isinstance(params, dict) else False
4841

@@ -53,7 +46,7 @@ def evaluation_function(
5346
feedback_items=[(
5447
"error",
5548
f"Invalid FSA format: {str(e)}\n\n"
56-
f"response: {response}\nanswer: {answer}\nparams: {params}\n\nconfig:{config}"
49+
f"response: {response}\nanswer: {answer}\nparams: {params}\n\nstudent config:{student_config}\n\nexpected config:{expected_config}"
5750
)]
5851
)
5952

evaluation_function/schemas/fsaFrontend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FSAFrontend(BaseModel):
5353
default_factory=list,
5454
description="F: Set of accepting/final states"
5555
)
56-
56+
config: str | None = Field(default=None)
5757
class Config:
5858
schema_extra = {
5959
"example": {

0 commit comments

Comments
 (0)