Skip to content

Commit e1e7513

Browse files
committed
fix: fixed parsing for fsa frontend to not break the zod schema
1 parent 85c1480 commit e1e7513

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

evaluation_function/evaluation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from typing import Any
22
from lf_toolkit.evaluation import Result as LFResult
3-
from .schemas import FSA
3+
from .schemas import FSA, FSAFrontend
44
from .schemas.result import Result
55
from .correction import analyze_fsa_correction
66

77
def validate_fsa(value: str | dict) -> FSA:
88
"""Parse a FSA from JSON string or dict."""
99
if isinstance(value, str):
10-
return FSA.model_validate_json(value)
11-
return FSA.model_validate(value)
10+
return FSAFrontend.model_validate_json(value).toFSA()
11+
return FSAFrontend.model_validate(value).toFSA()
1212

1313
def evaluation_function(
1414
response: Any = None,

evaluation_function/schemas/fsaFrontend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Config:
6969
}
7070

7171
@classmethod
72-
def from_flattened(cls, data: dict) -> FSA:
72+
def toFSA(cls, data: dict) -> FSA:
7373
"""
7474
Convert frontend FSA payload (with transitions as "from|symbol|to")
7575
into the FSABackend model with proper Transition objects.

0 commit comments

Comments
 (0)