You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pdf): enforce strict boolean typing for checkbox/radio fields
Per maintainer feedback in fireform-core#407:
- The fields dict now accepts Python types as values (e.g. {'is awake': bool})
- build_prompt() detects bool fields and explicitly instructs the LLM to
return only the literal string 'True' or 'False', not fuzzy values
- add_response_to_json() strictly coerces LLM output to Python bool for
bool fields, logging a warning if an unexpected value is returned
- filler.py now uses isinstance(answer, bool) instead of string matching
so only a guaranteed Python True activates a checkbox/radio button
- Updated example in main.py to demonstrate the new typed fields dict
user_input="Hi. The employee's name is John Doe. His job title is managing director. His department supervisor is Jane Doe. His phone number is 123456. His email is jdoe@ucsc.edu. The signature is <Mamañema>, and the date is 01/02/2005"
67
-
fields= [
68
-
"Employee's name",
69
-
"Employee's job title",
70
-
"Employee's department supervisor",
71
-
"Employee's phone number",
72
-
"Employee's email",
73
-
"Signature",
74
-
"Date",
75
-
]
67
+
# Fields dict maps each field name to its expected Python type.
68
+
# Use `bool` for checkbox/radio fields so the LLM is instructed to
69
+
# return exactly True or False instead of fuzzy strings like "yes".
0 commit comments