mirror of
https://github.com/Sea-Haven-Industries/procurement-ingest.git
synced 2026-10-07 16:08:54 +00:00
Coerce bare-int quantity/price to Decimal in enrich_parsed
GPT-4.1 cross-family review of the final PR diff (no BLOCK) flagged residual type drift: parse_float=Decimal rules out floats on the LLM path, but a bare JSON int survived as Python int. Coerce it so both parse paths emit one canonical Decimal type.
This commit is contained in:
parent
d247cd0cf7
commit
4bd426daf2
1 changed files with 5 additions and 0 deletions
|
|
@ -373,6 +373,11 @@ def enrich_parsed(parsed: dict, s3_key: str, email_subject: str):
|
|||
item[field] = Decimal(value.replace(",", "").strip())
|
||||
except InvalidOperation:
|
||||
pass
|
||||
elif isinstance(value, (int, float)) and not isinstance(value, bool):
|
||||
# parse_float=Decimal means floats can't occur on the LLM path,
|
||||
# but a bare JSON int would slip through as Python int; coerce
|
||||
# so both paths emit one canonical Decimal type (cross-review FIX).
|
||||
item[field] = Decimal(str(value))
|
||||
return parsed
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue