transformers
0130c7da - Fix KeyError in _parse_type_hint when Union contains Any (#44525)

Commit
17 days ago
Fix KeyError in _parse_type_hint when Union contains Any (#44525) fix: handle missing "type" key in Union subtype schema In _parse_type_hint, when processing Union types, the code accesses subtype["type"] without checking the key exists. Union types containing `Any` crash because _get_json_schema_type(Any) returns {} with no "type" key, causing a KeyError. Add a guard to check "type" key existence before accessing it. Signed-off-by: JiangNan <1394485448@qq.com> Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
Author
Parents
Loading